1 import {EditorUiContext, EditorUiElement, EditorUiStateUpdate} from "./base-elements";
2 import {el} from "../../helpers";
4 export class EditorContainerUiElement extends EditorUiElement {
5 protected children : EditorUiElement[];
7 constructor(children: EditorUiElement[]) {
9 this.children = children;
12 protected buildDOM(): HTMLElement {
13 return el('div', {}, this.getChildren().map(child => child.getDOMElement()));
16 getChildren(): EditorUiElement[] {
20 updateState(state: EditorUiStateUpdate): void {
21 for (const child of this.children) {
22 child.updateState(state);
26 setContext(context: EditorUiContext) {
27 for (const child of this.getChildren()) {
28 child.setContext(context);
33 export class EditorFormatMenu extends EditorContainerUiElement {
34 buildDOM(): HTMLElement {
36 class: 'editor-format-menu'
37 }, this.getChildren().map(child => child.getDOMElement()));