import {EditorContainerUiElement, EditorUiElement} from "../core";
-import {el} from "../../../helpers";
import {EditorDropdownButton} from "./dropdown-button";
import moreHorizontal from "@icons/editor/more-horizontal.svg"
+import {el} from "../../../utils/dom";
export class EditorOverflowContainer extends EditorContainerUiElement {
this.size = size;
this.content = children;
this.overflowButton = new EditorDropdownButton({
- label: 'More',
- icon: moreHorizontal,
+ button: {
+ label: 'More',
+ icon: moreHorizontal,
+ },
}, []);
this.addChildren(this.overflowButton);
}
protected buildDOM(): HTMLElement {
- const visibleChildren = this.content.slice(0, this.size);
- const invisibleChildren = this.content.slice(this.size);
+ const slicePosition = this.content.length > this.size ? this.size - 1 : this.size;
+ const visibleChildren = this.content.slice(0, slicePosition);
+ const invisibleChildren = this.content.slice(slicePosition);
const visibleElements = visibleChildren.map(child => child.getDOMElement());
if (invisibleChildren.length > 0) {