1 import {buildForEditor as buildEditorConfig} from '../wysiwyg/config';
2 import {Component} from './component';
4 export class WysiwygEditor extends Component {
9 this.tinyMceConfig = buildEditorConfig({
10 language: this.$opts.language,
11 containerElement: this.elem,
12 darkMode: document.documentElement.classList.contains('dark-mode'),
13 textDirection: this.$opts.textDirection,
14 drawioUrl: this.getDrawIoUrl(),
15 pageId: Number(this.$opts.pageId),
17 imageUploadErrorText: this.$opts.imageUploadErrorText,
18 serverUploadLimitText: this.$opts.serverUploadLimitText,
20 translationMap: window.editor_translations,
23 window.$events.emitPublic(this.elem, 'editor-tinymce::pre-init', {config: this.tinyMceConfig});
24 window.tinymce.init(this.tinyMceConfig).then(editors => {
25 this.editor = editors[0];
30 const drawioUrlElem = document.querySelector('[drawio-url]');
32 return drawioUrlElem.getAttribute('drawio-url');
38 * Get the content of this editor.
39 * Used by the parent page editor component.
40 * @return {{html: String}}
44 html: this.editor.getContent(),