1 import {build as buildEditorConfig} from '../wysiwyg/config';
2 import {Component} from './component';
4 export class WysiwygEditor extends Component {
9 this.pageId = this.$opts.pageId;
10 this.textDirection = this.$opts.textDirection;
11 this.isDarkMode = document.documentElement.classList.contains('dark-mode');
13 this.tinyMceConfig = buildEditorConfig({
14 language: this.$opts.language,
15 containerElement: this.elem,
16 darkMode: this.isDarkMode,
17 textDirection: this.textDirection,
18 drawioUrl: this.getDrawIoUrl(),
19 pageId: Number(this.pageId),
21 imageUploadErrorText: this.$opts.imageUploadErrorText,
22 serverUploadLimitText: this.$opts.serverUploadLimitText,
24 translationMap: window.editor_translations,
27 window.$events.emitPublic(this.elem, 'editor-tinymce::pre-init', {config: this.tinyMceConfig});
28 window.tinymce.init(this.tinyMceConfig).then(editors => {
29 this.editor = editors[0];
34 const drawioUrlElem = document.querySelector('[drawio-url]');
36 return drawioUrlElem.getAttribute('drawio-url');
42 * Get the content of this editor.
43 * Used by the parent page editor component.
44 * @return {{html: String}}
48 html: this.editor.getContent(),