2023-04-19 05:20:02 +08:00
|
|
|
import {Component} from './component';
|
2019-08-12 03:04:43 +08:00
|
|
|
|
2022-11-16 21:04:22 +08:00
|
|
|
export class WysiwygEditor extends Component {
|
2017-09-23 19:24:06 +08:00
|
|
|
|
2020-07-06 04:18:17 +08:00
|
|
|
setup() {
|
|
|
|
this.elem = this.$el;
|
2024-05-27 22:39:41 +08:00
|
|
|
this.editArea = this.$refs.editArea;
|
2020-07-06 04:18:17 +08:00
|
|
|
|
2024-05-27 22:39:41 +08:00
|
|
|
window.importVersioned('wysiwyg').then(wysiwyg => {
|
|
|
|
wysiwyg.createPageEditorInstance(this.editArea);
|
2023-02-23 20:30:27 +08:00
|
|
|
});
|
2018-04-01 20:21:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-06 07:15:58 +08:00
|
|
|
getDrawIoUrl() {
|
2020-04-06 00:27:16 +08:00
|
|
|
const drawioUrlElem = document.querySelector('[drawio-url]');
|
|
|
|
if (drawioUrlElem) {
|
2022-02-06 07:15:58 +08:00
|
|
|
return drawioUrlElem.getAttribute('drawio-url');
|
2018-04-01 20:21:11 +08:00
|
|
|
}
|
2022-02-06 07:15:58 +08:00
|
|
|
return '';
|
2017-09-23 19:24:06 +08:00
|
|
|
}
|
|
|
|
|
2023-02-23 20:30:27 +08:00
|
|
|
/**
|
|
|
|
* Get the content of this editor.
|
|
|
|
* Used by the parent page editor component.
|
|
|
|
* @return {{html: String}}
|
|
|
|
*/
|
|
|
|
getContent() {
|
2024-05-28 03:23:45 +08:00
|
|
|
// TODO - Update
|
2023-02-23 20:30:27 +08:00
|
|
|
return {
|
2023-04-19 05:20:02 +08:00
|
|
|
html: this.editor.getContent(),
|
2023-02-23 20:30:27 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-04-19 05:20:02 +08:00
|
|
|
}
|