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