]> BookStack Code Mirror - bookstack/blob - resources/js/components/wysiwyg-editor.js
Lexical: Added tracked container, added fullscreen action
[bookstack] / resources / js / components / wysiwyg-editor.js
1 import {Component} from './component';
2
3 export class WysiwygEditor extends Component {
4
5     setup() {
6         this.elem = this.$el;
7         this.editContainer = this.$refs.editContainer;
8         this.editContent = this.$refs.editContent;
9
10         window.importVersioned('wysiwyg').then(wysiwyg => {
11             const editorContent = this.editContent.textContent;
12             wysiwyg.createPageEditorInstance(this.editContainer, editorContent);
13         });
14     }
15
16     getDrawIoUrl() {
17         const drawioUrlElem = document.querySelector('[drawio-url]');
18         if (drawioUrlElem) {
19             return drawioUrlElem.getAttribute('drawio-url');
20         }
21         return '';
22     }
23
24     /**
25      * Get the content of this editor.
26      * Used by the parent page editor component.
27      * @return {{html: String}}
28      */
29     getContent() {
30         // TODO - Update
31         return {
32             html: this.editor.getContent(),
33         };
34     }
35
36 }