1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Lexical: Added mobile toolbar support

Adds dynamic and fixed (out of DOM order) positioning with location
adjustment depending on space.
Also adds smarter hiding to prevent disappearing when mouse leaves but
within the same space as the toggle.
This commit is contained in:
Dan Brown
2024-12-15 14:03:08 +00:00
parent a71aa241ad
commit 5f07f31c9f
6 changed files with 62 additions and 7 deletions

View File

@ -16,6 +16,7 @@ export class EditorButtonWithMenu extends EditorContainerUiElement {
button: {label: 'Menu', icon: caretDownIcon},
showOnHover: false,
direction: 'vertical',
showAside: false,
}, menuItems);
this.addChildren(this.dropdownButton);
}

View File

@ -7,12 +7,14 @@ import {EditorMenuButton} from "./menu-button";
export type EditorDropdownButtonOptions = {
showOnHover?: boolean;
direction?: 'vertical'|'horizontal';
showAside?: boolean;
button: EditorBasicButtonDefinition|EditorButton;
};
const defaultOptions: EditorDropdownButtonOptions = {
showOnHover: false,
direction: 'horizontal',
showAside: undefined,
button: {label: 'Menu'},
}
@ -65,6 +67,7 @@ export class EditorDropdownButton extends EditorContainerUiElement {
handleDropdown({toggle: button, menu : menu,
showOnHover: this.options.showOnHover,
showAside: typeof this.options.showAside === 'boolean' ? this.options.showAside : (this.options.direction === 'vertical'),
onOpen : () => {
this.open = true;
this.getContext().manager.triggerStateUpdateForElement(this.button);