1 import {EditorContainerUiElement, EditorUiElement} from "./core";
2 import {el} from "../../helpers";
4 export type EditorContextToolbarDefinition = {
6 content: EditorUiElement[],
7 displayTargetLocator?: (originalTarget: HTMLElement) => HTMLElement;
10 export class EditorContextToolbar extends EditorContainerUiElement {
12 protected buildDOM(): HTMLElement {
14 class: 'editor-context-toolbar',
15 }, this.getChildren().map(child => child.getDOMElement()));
18 attachTo(target: HTMLElement) {
19 // Todo - attach to target position
20 console.log('attaching context toolbar to', target);
23 insert(children: EditorUiElement[]) {
24 this.addChildren(...children);
25 const dom = this.getDOMElement();
26 dom.append(...children.map(child => child.getDOMElement()));
30 const children = this.getChildren();
31 for (const child of children) {
32 child.getDOMElement().remove();
34 this.removeChildren(...children);