-import {handleDropdown} from "../helpers/dropdowns";
import {EditorContainerUiElement, EditorUiElement} from "../core";
import {EditorBasicButtonDefinition, EditorButton} from "../buttons";
import {el} from "../../../utils/dom";
showOnHover?: boolean;
direction?: 'vertical'|'horizontal';
showAside?: boolean;
+ hideOnAction?: boolean;
button: EditorBasicButtonDefinition|EditorButton;
};
showOnHover: false,
direction: 'horizontal',
showAside: undefined,
+ hideOnAction: true,
button: {label: 'Menu'},
}
},
isActive: () => {
return this.open;
- }
+ },
});
}
class: 'editor-dropdown-menu-container',
}, [button, menu]);
- handleDropdown({toggle: button, menu : menu,
+ this.getContext().manager.dropdowns.handle({toggle: button, menu : menu,
showOnHover: this.options.showOnHover,
showAside: typeof this.options.showAside === 'boolean' ? this.options.showAside : (this.options.direction === 'vertical'),
onOpen : () => {
this.getContext().manager.triggerStateUpdateForElement(this.button);
}});
+ if (this.options.hideOnAction) {
+ this.onEvent('button-action', () => {
+ this.getContext().manager.dropdowns.closeAll();
+ }, wrapper);
+ }
+
return wrapper;
}
}
\ No newline at end of file