]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/index.ts
Lexical: Added code block selection & edit features
[bookstack] / resources / js / wysiwyg / index.ts
index d1d96b17233b3c30acc97a8161d79a2830635bc5..8cbaccd7979761ef027faf9d5a03d3df960fc3d6 100644 (file)
@@ -2,11 +2,12 @@ import {createEditor, CreateEditorArgs, LexicalEditor} from 'lexical';
 import {createEmptyHistoryState, registerHistory} from '@lexical/history';
 import {registerRichText} from '@lexical/rich-text';
 import {mergeRegister} from '@lexical/utils';
-import {getNodesForPageEditor} from './nodes';
+import {getNodesForPageEditor, registerCommonNodeMutationListeners} from './nodes';
 import {buildEditorUI} from "./ui";
 import {getEditorContentAsHtml, setEditorContentFromHtml} from "./actions";
 import {registerTableResizer} from "./ui/framework/helpers/table-resizer";
 import {el} from "./helpers";
+import {EditorUiContext} from "./ui/framework/core";
 
 export function createPageEditorInstance(container: HTMLElement, htmlContent: string): SimpleWysiwygEditorInterface {
     const config: CreateEditorArgs = {
@@ -59,7 +60,8 @@ export function createPageEditorInstance(container: HTMLElement, htmlContent: st
         }
     });
 
-    buildEditorUI(container, editArea, editor);
+    const context: EditorUiContext = buildEditorUI(container, editArea, editor);
+    registerCommonNodeMutationListeners(context);
 
     return new SimpleWysiwygEditorInterface(editor);
 }