mirror of
https://github.com/zadam/trilium.git
synced 2025-12-21 15:49:56 +01:00
Fix (left pane toggle logic): properly handle both synced and current window visibility states
This commit is contained in:
@@ -4,20 +4,26 @@ import appContext, { type EventData } from "../../components/app_context.js";
|
||||
import type Component from "../../components/component.js";
|
||||
|
||||
export default class LeftPaneContainer extends FlexContainer<Component> {
|
||||
private currentLeftPaneVisible: boolean;
|
||||
|
||||
constructor() {
|
||||
super("column");
|
||||
|
||||
this.currentLeftPaneVisible = options.is("leftPaneVisible");
|
||||
|
||||
this.id("left-pane");
|
||||
this.css("height", "100%");
|
||||
this.collapsible();
|
||||
}
|
||||
|
||||
isEnabled() {
|
||||
return super.isEnabled() && options.is("leftPaneVisible");
|
||||
return super.isEnabled() && this.currentLeftPaneVisible;
|
||||
}
|
||||
|
||||
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
|
||||
if (loadResults.isOptionReloaded("leftPaneVisible") && document.hasFocus()) {
|
||||
// options.is("leftPaneVisible") changed — it may or may not be the same as currentLeftPaneVisible, but as long as the window is focused, the left pane visibility should be toggled.
|
||||
this.currentLeftPaneVisible = !this.currentLeftPaneVisible;
|
||||
const visible = this.isEnabled();
|
||||
this.toggleInt(visible);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user