mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 23:35:50 +01:00
right pane restoration for custom widgets
This commit is contained in:
27
src/public/app/widgets/containers/right_pane_container.js
Normal file
27
src/public/app/widgets/containers/right_pane_container.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import FlexContainer from "./flex_container.js";
|
||||
|
||||
export default class RightPaneContainer extends FlexContainer {
|
||||
constructor() {
|
||||
super('column');
|
||||
|
||||
this.id('right-pane');
|
||||
this.css('height', '100%');
|
||||
}
|
||||
|
||||
isEnabled() {
|
||||
return super.isEnabled() && this.children.length > 0 && !!this.children.find(ch => ch.isEnabled());
|
||||
}
|
||||
|
||||
handleEventInChildren(name, data) {
|
||||
const promise = super.handleEventInChildren(name, data);
|
||||
|
||||
if (['activeContextChanged', 'noteSwitchedAndActivated', 'noteSwitched'].includes(name)) {
|
||||
// right pane is displayed only if some child widget is active
|
||||
// we'll reevaluate the visibility based on events which are probable to cause visibility change
|
||||
// but these events needs to be finished and only then we check
|
||||
promise.then(() => this.toggleInt(this.isEnabled()));
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user