]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/index.ts
respective book and chapter structure added.
[bookstack] / resources / js / wysiwyg / index.ts
index 9015cea0c5638c8a10f29cca18a9751c35269dd9..c4403773bf2a93f6dfb3551da78bc10493643766 100644 (file)
@@ -14,6 +14,7 @@ import {registerTableSelectionHandler} from "./ui/framework/helpers/table-select
 import {el} from "./utils/dom";
 import {registerShortcuts} from "./services/shortcuts";
 import {registerNodeResizer} from "./ui/framework/helpers/node-resizer";
+import {registerKeyboardHandling} from "./services/keyboard-handling";
 
 export function createPageEditorInstance(container: HTMLElement, htmlContent: string, options: Record<string, any> = {}): SimpleWysiwygEditorInterface {
     const config: CreateEditorArgs = {
@@ -41,8 +42,13 @@ export function createPageEditorInstance(container: HTMLElement, htmlContent: st
     const editWrap = el('div', {
         class: 'editor-content-wrap',
     }, [editArea]);
+
     container.append(editWrap);
     container.classList.add('editor-container');
+    container.setAttribute('dir', options.textDirection);
+    if (options.darkMode) {
+        container.classList.add('editor-dark');
+    }
 
     const editor = createEditor(config);
     editor.setRootElement(editArea);
@@ -52,6 +58,7 @@ export function createPageEditorInstance(container: HTMLElement, htmlContent: st
         registerRichText(editor),
         registerHistory(editor, createEmptyHistoryState(), 300),
         registerShortcuts(context),
+        registerKeyboardHandling(context),
         registerTableResizer(editor, editWrap),
         registerTableSelectionHandler(editor),
         registerTaskListHandler(editor, editArea),