]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/wysiwyg-editor.js
respective book and chapter structure added.
[bookstack] / resources / js / components / wysiwyg-editor.js
index deb37186471440e00a73498c68ece6e0267d4b23..56dbe8d7c5f199d06a50facf5394d8e9a1034bc7 100644 (file)
@@ -10,9 +10,21 @@ export class WysiwygEditor extends Component {
         /** @var {SimpleWysiwygEditorInterface|null} */
         this.editor = null;
 
+        const translations = {
+            ...window.editor_translations,
+            imageUploadErrorText: this.$opts.imageUploadErrorText,
+            serverUploadLimitText: this.$opts.serverUploadLimitText,
+        };
+
         window.importVersioned('wysiwyg').then(wysiwyg => {
             const editorContent = this.input.value;
-            this.editor = wysiwyg.createPageEditorInstance(this.editContainer, editorContent);
+            this.editor = wysiwyg.createPageEditorInstance(this.editContainer, editorContent, {
+                drawioUrl: this.getDrawIoUrl(),
+                pageId: Number(this.$opts.pageId),
+                darkMode: document.documentElement.classList.contains('dark-mode'),
+                textDirection: this.$opts.textDirection,
+                translations,
+            });
         });
 
         let handlingFormSubmit = false;
@@ -35,7 +47,6 @@ export class WysiwygEditor extends Component {
     }
 
     getDrawIoUrl() {
-        // TODO
         const drawioUrlElem = document.querySelector('[drawio-url]');
         if (drawioUrlElem) {
             return drawioUrlElem.getAttribute('drawio-url');