/** @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,
+ });
+ window.wysiwyg = this.editor;
});
let handlingFormSubmit = false;
handlingFormSubmit = true;
this.editor.getContentAsHtml().then(html => {
this.input.value = html;
- this.input.form.submit();
+ setTimeout(() => {
+ this.input.form.requestSubmit();
+ }, 5);
});
} else {
handlingFormSubmit = false;
}
getDrawIoUrl() {
- // TODO
const drawioUrlElem = document.querySelector('[drawio-url]');
if (drawioUrlElem) {
return drawioUrlElem.getAttribute('drawio-url');