mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fixes in side pane toggling
This commit is contained in:
parent
9c631e4398
commit
4e0e2e8926
@ -2,7 +2,7 @@ import options from "./options.js";
|
|||||||
|
|
||||||
let instance;
|
let instance;
|
||||||
|
|
||||||
async function setupSplit(left, right) {
|
function setupSplit(left, right) {
|
||||||
if (instance) {
|
if (instance) {
|
||||||
instance.destroy();
|
instance.destroy();
|
||||||
instance = null;
|
instance = null;
|
||||||
|
@ -15,16 +15,8 @@ export default class SidePaneContainer extends FlexContainer {
|
|||||||
return super.isEnabled() && options.is(this.side + 'PaneVisible');
|
return super.isEnabled() && options.is(this.side + 'PaneVisible');
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEvent(name, data) {
|
|
||||||
if (options.is(this.side + 'PaneVisible')) {
|
|
||||||
super.handleEvent(name, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sidebarVisibilityChangedEvent({side, show}) {
|
sidebarVisibilityChangedEvent({side, show}) {
|
||||||
if (this.side === side) {
|
if (this.side === side && show) {
|
||||||
this.toggle(show);
|
|
||||||
|
|
||||||
this.handleEvent('lazyLoaded');
|
this.handleEvent('lazyLoaded');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,6 @@ export default class SidePaneToggles extends BasicWidget {
|
|||||||
doRender() {
|
doRender() {
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
|
|
||||||
this.toggleSidebar('left', options.is('leftPaneVisible'));
|
|
||||||
this.toggleSidebar('right', options.is('rightPaneVisible'));
|
|
||||||
|
|
||||||
this.$widget.find(".show-right-pane-button").on('click', () => this.toggleAndSave('right', true));
|
this.$widget.find(".show-right-pane-button").on('click', () => this.toggleAndSave('right', true));
|
||||||
this.$widget.find(".hide-right-pane-button").on('click', () => this.toggleAndSave('right', false));
|
this.$widget.find(".hide-right-pane-button").on('click', () => this.toggleAndSave('right', false));
|
||||||
|
|
||||||
@ -59,16 +56,19 @@ export default class SidePaneToggles extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async toggleAndSave(side, show) {
|
async toggleAndSave(side, show) {
|
||||||
this.toggleSidebar(side, show);
|
|
||||||
|
|
||||||
await options.save(`${side}PaneVisible`, show.toString());
|
await options.save(`${side}PaneVisible`, show.toString());
|
||||||
|
|
||||||
|
this.toggleSidebar(side, show);
|
||||||
|
|
||||||
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
|
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
|
||||||
|
|
||||||
this.triggerEvent('sidebarVisibilityChanged', {side, show});
|
this.triggerEvent('sidebarVisibilityChanged', {side, show});
|
||||||
}
|
}
|
||||||
|
|
||||||
initialRenderCompleteEvent() {
|
initialRenderCompleteEvent() {
|
||||||
|
this.toggleSidebar('left', options.is('leftPaneVisible'));
|
||||||
|
this.toggleSidebar('right', options.is('rightPaneVisible'));
|
||||||
|
|
||||||
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
|
splitService.setupSplit(this.paneVisible.left, this.paneVisible.right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user