]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/ui/framework/blocks/external-content.ts
Merge pull request #5731 from BookStackApp/lexical_jul25
[bookstack] / resources / js / wysiwyg / ui / framework / blocks / external-content.ts
1 import {EditorUiElement} from "../core";
2 import {el} from "../../../utils/dom";
3
4 export class ExternalContent extends EditorUiElement {
5
6     /**
7      * The URL for HTML to be loaded from.
8      */
9     protected url: string = '';
10
11     constructor(url: string) {
12         super();
13         this.url = url;
14     }
15
16     buildDOM(): HTMLElement {
17         const wrapper = el('div', {
18             class: 'editor-external-content',
19         });
20
21         window.$http.get(this.url).then(resp => {
22             if (typeof resp.data === 'string') {
23                 wrapper.innerHTML = resp.data;
24             }
25         });
26
27         return wrapper;
28     }
29 }