1 import {EditorContainerUiElement, EditorUiElement} from "../core";
2 import {el} from "../../../helpers";
3 import {EditorDropdownButton} from "./dropdown-button";
4 import moreHorizontal from "@icons/editor/more-horizontal.svg"
7 export class EditorOverflowContainer extends EditorContainerUiElement {
9 protected size: number;
10 protected overflowButton: EditorDropdownButton;
11 protected content: EditorUiElement[];
13 constructor(size: number, children: EditorUiElement[]) {
16 this.content = children;
17 this.overflowButton = new EditorDropdownButton({
21 this.addChildren(this.overflowButton);
24 protected buildDOM(): HTMLElement {
25 const visibleChildren = this.content.slice(0, this.size);
26 const invisibleChildren = this.content.slice(this.size);
28 const visibleElements = visibleChildren.map(child => child.getDOMElement());
29 if (invisibleChildren.length > 0) {
30 this.removeChildren(...invisibleChildren);
31 this.overflowButton.insertItems(...invisibleChildren);
32 visibleElements.push(this.overflowButton.getDOMElement());
36 class: 'editor-overflow-container',