]> BookStack Code Mirror - bookstack/blob - resources/js/components/wysiwyg-editor.js
Editors: Added lexical editor for testing
[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.editArea = this.$refs.editArea;
8
9         window.importVersioned('wysiwyg').then(wysiwyg => {
10             wysiwyg.createPageEditorInstance(this.editArea);
11         });
12     }
13
14     getDrawIoUrl() {
15         const drawioUrlElem = document.querySelector('[drawio-url]');
16         if (drawioUrlElem) {
17             return drawioUrlElem.getAttribute('drawio-url');
18         }
19         return '';
20     }
21
22     /**
23      * Get the content of this editor.
24      * Used by the parent page editor component.
25      * @return {{html: String}}
26      */
27     getContent() {
28         return {
29             html: this.editor.getContent(),
30         };
31     }
32
33 }