trilium/src/public/javascripts/widgets/side_pane_container.js

28 lines
770 B
JavaScript
Raw Normal View History

import options from "../services/options.js";
2020-02-08 05:19:35 +08:00
import FlexContainer from "./flex_container.js";
2020-02-08 05:19:35 +08:00
export default class SidePaneContainer extends FlexContainer {
constructor(parent, side, widgetFactories) {
super(parent, {id: side + '-pane', 'flex-direction': 'column', 'height': '100%'}, widgetFactories);
this.side = side;
}
isEnabled() {
return super.isEnabled() && options.is(this.side + 'PaneVisible');
}
2020-02-17 02:21:17 +08:00
handleEvent(name, data) {
if (options.is(this.side + 'PaneVisible')) {
2020-02-17 02:21:17 +08:00
super.handleEvent(name, data);
}
}
2020-02-17 02:23:49 +08:00
sidebarVisibilityChangedEvent({side, show}) {
if (this.side === side) {
this.toggle(show);
2020-02-17 02:21:17 +08:00
this.handleEvent('lazyLoaded');
}
}
}