Add NpsPoll feature support for Email editor

MAILPOET-6315
This commit is contained in:
Oluwaseun Olorunsola
2024-11-18 13:44:36 +01:00
committed by Jan Lysý
parent 116e20f89b
commit b9b503889d
5 changed files with 54 additions and 5 deletions

View File

@ -1,10 +1,10 @@
import '@wordpress/format-library'; // Enables text formatting capabilities
import { useSelect } from '@wordpress/data';
import { StrictMode, createRoot } from '@wordpress/element';
// import { withNpsPoll } from '../../nps-poll'; // TODO: need to fix this import. custom component from core MP plugin
import { applyFilters } from '@wordpress/hooks';
import { initBlocks } from './blocks';
import { initializeLayout } from './layouts/flex-email';
import { InnerEditor } from './components/block-editor/editor';
import { InnerEditor } from './components/block-editor';
import { createStore, storeName } from './store';
import { initHooks } from './editor-hooks';
import { KeyboardShortcuts } from './components/keybord-shortcuts';
@ -32,6 +32,11 @@ function Editor() {
);
}
const WrappedEditor = applyFilters(
'mailpoet_email_editor_the_editor_component',
Editor
);
export function initialize( elementId: string ) {
const container = document.getElementById( elementId );
if ( ! container ) {
@ -42,5 +47,6 @@ export function initialize( elementId: string ) {
initBlocks();
initHooks();
const root = createRoot( container );
root.render( <Editor /> );
// @ts-ignore
root.render( <WrappedEditor /> );
}