BookStack/resources/js/components/wysiwyg-editor.js
Dan Brown c2ecbf071f
Lexical: Added tracked container, added fullscreen action
Changed how the editor is loaded in, so it now creates its own DOM, and
content is passed via creation function, to be better self-contained.
2024-07-01 10:44:23 +01:00

37 lines
941 B
JavaScript

import {Component} from './component';
export class WysiwygEditor extends Component {
setup() {
this.elem = this.$el;
this.editContainer = this.$refs.editContainer;
this.editContent = this.$refs.editContent;
window.importVersioned('wysiwyg').then(wysiwyg => {
const editorContent = this.editContent.textContent;
wysiwyg.createPageEditorInstance(this.editContainer, editorContent);
});
}
getDrawIoUrl() {
const drawioUrlElem = document.querySelector('[drawio-url]');
if (drawioUrlElem) {
return drawioUrlElem.getAttribute('drawio-url');
}
return '';
}
/**
* Get the content of this editor.
* Used by the parent page editor component.
* @return {{html: String}}
*/
getContent() {
// TODO - Update
return {
html: this.editor.getContent(),
};
}
}