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:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user