From 7e64e31dfe7d4d30b68991ace7fae258000f27e7 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sat, 17 May 2025 23:51:37 +0800 Subject: [PATCH 01/19] Fix: The button for toggling the left pane visibility in the launcher was initially not visible on startup --- apps/client/src/widgets/buttons/left_pane_toggle.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/buttons/left_pane_toggle.ts b/apps/client/src/widgets/buttons/left_pane_toggle.ts index 88528add5..80725a3e8 100644 --- a/apps/client/src/widgets/buttons/left_pane_toggle.ts +++ b/apps/client/src/widgets/buttons/left_pane_toggle.ts @@ -32,10 +32,8 @@ export default class LeftPaneToggleWidget extends CommandButtonWidget { } refreshIcon() { - if (document.hasFocus() || this.currentLeftPaneVisible === true) { - super.refreshIcon(); - splitService.setupLeftPaneResizer(this.currentLeftPaneVisible); - } + super.refreshIcon(); + splitService.setupLeftPaneResizer(this.currentLeftPaneVisible); } entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { From c65f0d4249bee56b7913a808445eb99294ffb77e Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sun, 18 May 2025 10:22:49 +0800 Subject: [PATCH 02/19] Fix (left pane toggle logic): properly handle both synced and current window visibility states --- apps/client/src/widgets/buttons/left_pane_toggle.ts | 8 +++++--- apps/client/src/widgets/containers/left_pane_container.ts | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/buttons/left_pane_toggle.ts b/apps/client/src/widgets/buttons/left_pane_toggle.ts index 80725a3e8..99fa0530b 100644 --- a/apps/client/src/widgets/buttons/left_pane_toggle.ts +++ b/apps/client/src/widgets/buttons/left_pane_toggle.ts @@ -19,10 +19,10 @@ export default class LeftPaneToggleWidget extends CommandButtonWidget { return "bx-sidebar"; } - return options.is("leftPaneVisible") ? "bx-chevrons-left" : "bx-chevrons-right"; + return this.currentLeftPaneVisible ? "bx-chevrons-left" : "bx-chevrons-right"; }; - this.settings.title = () => (options.is("leftPaneVisible") ? t("left_pane_toggle.hide_panel") : t("left_pane_toggle.show_panel")); + this.settings.title = () => (this.currentLeftPaneVisible ? t("left_pane_toggle.hide_panel") : t("left_pane_toggle.show_panel")); this.settings.command = () => (this.currentLeftPaneVisible ? "hideLeftPane" : "showLeftPane"); @@ -38,7 +38,9 @@ export default class LeftPaneToggleWidget extends CommandButtonWidget { entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { if (loadResults.isOptionReloaded("leftPaneVisible") && document.hasFocus()) { - this.currentLeftPaneVisible = options.is("leftPaneVisible"); + // 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. + // See PR description for detailed explanation of multi-window edge cases: https://github.com/TriliumNext/Notes/pull/1962 + this.currentLeftPaneVisible = !this.currentLeftPaneVisible; this.refreshIcon(); } } diff --git a/apps/client/src/widgets/containers/left_pane_container.ts b/apps/client/src/widgets/containers/left_pane_container.ts index 2b8221553..c9016b8ae 100644 --- a/apps/client/src/widgets/containers/left_pane_container.ts +++ b/apps/client/src/widgets/containers/left_pane_container.ts @@ -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 { + 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); From d650532e104e3892fd7b4bc3fe9d75f68974f47e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 18 May 2025 06:29:49 +0000 Subject: [PATCH 03/19] chore(deps): update dependency @types/diff to v8 --- apps/db-compare/package.json | 2 +- pnpm-lock.yaml | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/db-compare/package.json b/apps/db-compare/package.json index c31b7562d..356798569 100644 --- a/apps/db-compare/package.json +++ b/apps/db-compare/package.json @@ -69,6 +69,6 @@ } }, "devDependencies": { - "@types/diff": "^7.0.2" + "@types/diff": "^8.0.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ee31587ec..2ef2a75bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -332,8 +332,8 @@ importers: version: 5.1.7 devDependencies: '@types/diff': - specifier: ^7.0.2 - version: 7.0.2 + specifier: ^8.0.0 + version: 8.0.0 apps/desktop: dependencies: @@ -5171,8 +5171,9 @@ packages: '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} - '@types/diff@7.0.2': - resolution: {integrity: sha512-JSWRMozjFKsGlEjiiKajUjIJVKuKdE3oVy2DNtK+fUo8q82nhFZ2CPQwicAIkXrofahDXrWJ7mjelvZphMS98Q==} + '@types/diff@8.0.0': + resolution: {integrity: sha512-o7jqJM04gfaYrdCecCVMbZhNdG6T1MHg/oQoRFdERLV+4d+V7FijhiEAbFu0Usww84Yijk9yH58U4Jk4HbtzZw==} + deprecated: This is a stub types definition. diff provides its own type definitions, so you do not need this installed. '@types/ejs@3.1.5': resolution: {integrity: sha512-nv+GSx77ZtXiJzwKdsASqi+YQ5Z7vwHsTP0JY2SiQgjGckkBRKZnk8nIM+7oUZ1VCtuTz0+By4qVR7fqzp/Dfg==} @@ -19549,7 +19550,9 @@ snapshots: dependencies: '@types/ms': 2.1.0 - '@types/diff@7.0.2': {} + '@types/diff@8.0.0': + dependencies: + diff: 8.0.1 '@types/ejs@3.1.5': {} From 22b64a0dc4110b8061b851eb90686b25f6d83994 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sun, 18 May 2025 16:24:13 +0800 Subject: [PATCH 04/19] fix(ui): Exclude launcher pane width from Split calculation; Record Split state for multiple windows --- apps/client/src/services/resizer.ts | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/apps/client/src/services/resizer.ts b/apps/client/src/services/resizer.ts index 1cce0f993..4b80db7ba 100644 --- a/apps/client/src/services/resizer.ts +++ b/apps/client/src/services/resizer.ts @@ -3,7 +3,11 @@ import Split from "split.js" export const DEFAULT_GUTTER_SIZE = 5; +let leftPaneWidth: number; +let reservedPx: number; +let layoutOrientation: string; let leftInstance: ReturnType | null; +let rightPaneWidth: number; let rightInstance: ReturnType | null; function setupLeftPaneResizer(leftPaneVisible: boolean) { @@ -14,27 +18,34 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) { $("#left-pane").toggle(leftPaneVisible); + layoutOrientation = layoutOrientation ?? options.get("layoutOrientation"); + reservedPx = reservedPx ?? (layoutOrientation === "vertical" ? ($("#launcher-pane").outerWidth() || 0) : 0); + // Window resizing causes `window.innerWidth` to change, so `reservedWidth` needs to be recalculated each time. + const reservedWidth = reservedPx / window.innerWidth * 100; if (!leftPaneVisible) { - $("#rest-pane").css("width", "100%"); - + $("#rest-pane").css("width", layoutOrientation === "vertical" ? `calc(100% - ${reservedWidth})` : "100%"); return; } - let leftPaneWidth = options.getInt("leftPaneWidth"); + leftPaneWidth = leftPaneWidth ?? (options.getInt("leftPaneWidth") ?? 0); if (!leftPaneWidth || leftPaneWidth < 5) { leftPaneWidth = 5; } + const restPaneWidth = 100 - leftPaneWidth - reservedWidth; if (leftPaneVisible) { // Delayed initialization ensures that all DOM elements are fully rendered and part of the layout, // preventing Split.js from retrieving incorrect dimensions due to #left-pane not being rendered yet, // which would cause the minSize setting to have no effect. requestAnimationFrame(() => { leftInstance = Split(["#left-pane", "#rest-pane"], { - sizes: [leftPaneWidth, 100 - leftPaneWidth], + sizes: [leftPaneWidth, restPaneWidth], gutterSize: DEFAULT_GUTTER_SIZE, minSize: [150, 300], - onDragEnd: (sizes) => options.save("leftPaneWidth", Math.round(sizes[0])) + onDragEnd: (sizes) => { + leftPaneWidth = Math.round(sizes[0]); + options.save("leftPaneWidth", Math.round(sizes[0])); + } }); }); } @@ -54,7 +65,7 @@ function setupRightPaneResizer() { return; } - let rightPaneWidth = options.getInt("rightPaneWidth"); + rightPaneWidth = rightPaneWidth ?? (options.getInt("rightPaneWidth") ?? 0); if (!rightPaneWidth || rightPaneWidth < 5) { rightPaneWidth = 5; } @@ -63,8 +74,11 @@ function setupRightPaneResizer() { rightInstance = Split(["#center-pane", "#right-pane"], { sizes: [100 - rightPaneWidth, rightPaneWidth], gutterSize: DEFAULT_GUTTER_SIZE, - minSize: [ 300, 180 ], - onDragEnd: (sizes) => options.save("rightPaneWidth", Math.round(sizes[1])) + minSize: [300, 180], + onDragEnd: (sizes) => { + rightPaneWidth = Math.round(sizes[1]); + options.save("rightPaneWidth", Math.round(sizes[1])); + } }); } } From 0e9c381df4f2e446a791b7312a6756eb785547f5 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sun, 18 May 2025 18:19:54 +0800 Subject: [PATCH 05/19] fix(launcher-pane): Prevent the launcher pane from being compressed --- apps/client/src/stylesheets/theme-next/shell.css | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/client/src/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.css index 2bcdf942f..a77715136 100644 --- a/apps/client/src/stylesheets/theme-next/shell.css +++ b/apps/client/src/stylesheets/theme-next/shell.css @@ -127,6 +127,7 @@ body.layout-horizontal > .horizontal { --launcher-pane-button-gap: var(--launcher-pane-vert-button-gap); width: var(--launcher-pane-size) !important; + min-width: var(--launcher-pane-size) !important; padding-bottom: var(--launcher-pane-button-gap); } From 9682253ceda280bc9cd00f4314443ffcaf2141f9 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sun, 18 May 2025 18:38:52 +0800 Subject: [PATCH 06/19] fix: Incorrectly calculating rest-pane width in https://github.com/TriliumNext/Notes/pull/1962 --- apps/client/src/services/resizer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/client/src/services/resizer.ts b/apps/client/src/services/resizer.ts index 4b80db7ba..be148f3ec 100644 --- a/apps/client/src/services/resizer.ts +++ b/apps/client/src/services/resizer.ts @@ -23,7 +23,7 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) { // Window resizing causes `window.innerWidth` to change, so `reservedWidth` needs to be recalculated each time. const reservedWidth = reservedPx / window.innerWidth * 100; if (!leftPaneVisible) { - $("#rest-pane").css("width", layoutOrientation === "vertical" ? `calc(100% - ${reservedWidth})` : "100%"); + $("#rest-pane").css("width", layoutOrientation === "vertical" ? `${(100 - reservedWidth) * 100}%` : "100%"); return; } From 0d09a7558fba4a44c7bcbfe10f302a5212537528 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Sun, 18 May 2025 20:19:30 +0800 Subject: [PATCH 07/19] fix: Incorrectly calculating rest-pane width --- apps/client/src/services/resizer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/client/src/services/resizer.ts b/apps/client/src/services/resizer.ts index be148f3ec..e0dc40995 100644 --- a/apps/client/src/services/resizer.ts +++ b/apps/client/src/services/resizer.ts @@ -23,7 +23,7 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) { // Window resizing causes `window.innerWidth` to change, so `reservedWidth` needs to be recalculated each time. const reservedWidth = reservedPx / window.innerWidth * 100; if (!leftPaneVisible) { - $("#rest-pane").css("width", layoutOrientation === "vertical" ? `${(100 - reservedWidth) * 100}%` : "100%"); + $("#rest-pane").css("width", layoutOrientation === "vertical" ? `${100 - reservedWidth}%` : "100%"); return; } From abfdf40e43c769f37ee9ec1ee93deed322f9ce0b Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Mon, 19 May 2025 18:27:22 +0800 Subject: [PATCH 08/19] fix(global_menu): Fix update button is blank --- apps/client/src/widgets/buttons/global_menu.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/client/src/widgets/buttons/global_menu.ts b/apps/client/src/widgets/buttons/global_menu.ts index d21e43b0d..0f216fc0a 100644 --- a/apps/client/src/widgets/buttons/global_menu.ts +++ b/apps/client/src/widgets/buttons/global_menu.ts @@ -53,10 +53,6 @@ const TPL = /*html*/` pointer-events: none; } - .update-to-latest-version-button { - display: none; - } - .global-menu .zoom-container { display: flex; flex-direction: row; @@ -235,7 +231,7 @@ const TPL = /*html*/` ${t("global_menu.about")} - - -