]> BookStack Code Mirror - bookstack/blob - resources/js/components/wysiwyg-input.js
Merge pull request #4729 from BookStackApp/description_wysiwyg
[bookstack] / resources / js / components / wysiwyg-input.js
1 import {Component} from './component';
2 import {buildForInput} from '../wysiwyg/config';
3
4 export class WysiwygInput extends Component {
5
6     setup() {
7         this.elem = this.$el;
8
9         const config = buildForInput({
10             language: this.$opts.language,
11             containerElement: this.elem,
12             darkMode: document.documentElement.classList.contains('dark-mode'),
13             textDirection: this.textDirection,
14             translations: {
15                 imageUploadErrorText: this.$opts.imageUploadErrorText,
16                 serverUploadLimitText: this.$opts.serverUploadLimitText,
17             },
18             translationMap: window.editor_translations,
19         });
20
21         window.tinymce.init(config).then(editors => {
22             this.editor = editors[0];
23         });
24     }
25
26 }