]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/wysiwyg-editor.js
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / resources / js / components / wysiwyg-editor.js
index eed1c61555f79f11f0c3528786a96c1284e33412..5a25819006913a5630d4664b5464e8420e5c8919 100644 (file)
@@ -10,6 +10,12 @@ 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, {
@@ -17,11 +23,9 @@ export class WysiwygEditor extends Component {
                 pageId: Number(this.$opts.pageId),
                 darkMode: document.documentElement.classList.contains('dark-mode'),
                 textDirection: this.$opts.textDirection,
-                translations: {
-                    imageUploadErrorText: this.$opts.imageUploadErrorText,
-                    serverUploadLimitText: this.$opts.serverUploadLimitText,
-                },
+                translations,
             });
+            window.wysiwyg = this.editor;
         });
 
         let handlingFormSubmit = false;
@@ -35,7 +39,9 @@ export class WysiwygEditor extends Component {
                 handlingFormSubmit = true;
                 this.editor.getContentAsHtml().then(html => {
                     this.input.value = html;
-                    this.input.form.submit();
+                    setTimeout(() => {
+                        this.input.form.requestSubmit();
+                    }, 5);
                 });
             } else {
                 handlingFormSubmit = false;