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

29 lines
824 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(appContext, side, widgets) {
2020-02-08 05:19:35 +08:00
super(appContext, {id: side + '-pane', 'flex-direction': 'column', 'height': '100%'}, widgets);
this.side = side;
this.children = widgets;
}
isEnabled() {
return super.isEnabled() && options.is(this.side + 'PaneVisible');
}
eventReceived(name, data, sync = false) {
if (options.is(this.side + 'PaneVisible')) {
super.eventReceived(name, data, sync);
}
}
sidebarVisibilityChangedListener({side, show}) {
if (this.side === side) {
this.toggle(show);
this.eventReceived('lazyLoaded');
}
}
}