1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-17 22:02:15 +03:00

Lexical: Started dev API outline

This commit is contained in:
Dan Brown
2025-11-30 17:02:17 +00:00
parent 9e8088f186
commit 9d732d8dd8
7 changed files with 129 additions and 10 deletions

View File

@@ -9,9 +9,11 @@ export class EditorOverflowContainer extends EditorContainerUiElement {
protected size: number;
protected overflowButton: EditorDropdownButton;
protected content: EditorUiElement[];
protected label: string;
constructor(size: number, children: EditorUiElement[]) {
constructor(label: string, size: number, children: EditorUiElement[]) {
super(children);
this.label = label;
this.size = size;
this.content = children;
this.overflowButton = new EditorDropdownButton({
@@ -24,6 +26,11 @@ export class EditorOverflowContainer extends EditorContainerUiElement {
this.addChildren(this.overflowButton);
}
addChild(child: EditorUiElement, targetIndex: number = -1): void {
this.content.splice(targetIndex, 0, child);
this.addChildren(child);
}
protected buildDOM(): HTMLElement {
const slicePosition = this.content.length > this.size ? this.size - 1 : this.size;
const visibleChildren = this.content.slice(0, slicePosition);
@@ -41,5 +48,8 @@ export class EditorOverflowContainer extends EditorContainerUiElement {
}, visibleElements);
}
getLabel(): string {
return this.label;
}
}