Add proper body class for the email editor to mark it a block editor

This class is needed so that some CSS rules (e.g. white background, hidden footer)
are applied for WP admin.
[MAILPOET-5854]
This commit is contained in:
Rostislav Wolny
2024-01-26 11:23:13 +01:00
committed by Jan Lysý
parent 414e540f33
commit cc8bb10d8b
2 changed files with 9 additions and 2 deletions

View File

@ -270,7 +270,7 @@ class Menu {
);
// newsletter editor
$this->wp->addSubmenuPage(
$emailEditorPage = $this->wp->addSubmenuPage(
self::EMAILS_PAGE_SLUG,
$this->setPageTitle(__('Email', 'mailpoet')),
esc_html__('Email Editor', 'mailpoet'),
@ -282,6 +282,13 @@ class Menu {
]
);
// add body class for form editor page
$this->wp->addAction('load-' . $emailEditorPage, function() {
$this->wp->addFilter('admin_body_class', function ($classes) {
return ltrim($classes . ' block-editor-page');
});
});
$this->registerAutomationMenu();
// Forms page