Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Keep the notification gap consistent when the right dock bar is hidden

Jeffrey Chenea0f6779b24c
diff --git a/app/src/assets/scss/component/_snackbar.scss b/app/src/assets/scss/component/_snackbar.scss
index d0de1f133a..339c8eb415 100644
--- a/app/src/assets/scss/component/_snackbar.scss
+++ b/app/src/assets/scss/component/_snackbar.scss
@@ -5,7 +5,7 @@ body {
--b3-snackbar-top-bar-height: var(--b3-ui-toolbar-height, 32px);
// 原生窗口控件可能高于顶栏,通知从其下方开始
--b3-snackbar-top: calc(max(var(--b3-snackbar-top-bar-height), var(--b3-window-controls-height, 0px)) + var(--b3-snackbar-gap));
- // 右侧停靠栏占用布局空间时避让它的宽度,隐藏或浮动时只保留窗口边缘间距
+ // 避让右侧内容左边界:停靠栏占用布局时是栏宽,隐藏或浮动时是编辑区外边距
--b3-snackbar-right: calc(var(--b3-dock-right-width, 0px) + var(--b3-snackbar-gap));
}
diff --git a/app/src/layout/dock/barVisibility.ts b/app/src/layout/dock/barVisibility.ts
index a9d0473fb5..47859052cf 100644
--- a/app/src/layout/dock/barVisibility.ts
+++ b/app/src/layout/dock/barVisibility.ts
@@ -147,7 +147,7 @@ export const syncDockBarVisibility = () => {
let changed = false;
let hasFloatingBar = false;
const cornerElements: HTMLElement[] = [];
- // 右侧停靠栏占用布局空间时记录宽度,供通知等固定定位元素避让
+ // 右侧内容左边界与窗口边缘的距离,供通知等固定定位元素避让
let rightDockWidth = "0px";
document.querySelectorAll<HTMLElement>(".dock").forEach((item) => {
const sections = Array.from(item.querySelectorAll<HTMLElement>(":scope > .dock__items"));
@@ -193,8 +193,10 @@ export const syncDockBarVisibility = () => {
);
changed = item.classList.contains("fn__none") !== hidden || wasFloating !== displayingFloat || changed;
item.classList.toggle("fn__none", hidden);
- if (item.id === "dockRight" && !hidden && !displayingFloat) {
- rightDockWidth = "var(--b3-ui-dock-width, 42px)";
+ if (item.id === "dockRight") {
+ // 停靠栏占用布局时是栏宽,隐藏或浮动时编辑区只保留自身外边距
+ rightDockWidth = !hidden && !displayingFloat ? "var(--b3-ui-dock-width, 42px)" :
+ "var(--b3-layout-space)";
}
if (displayingFloat) {
hasFloatingBar = true;
diff --git a/app/tests/dockBarVisibility.test.js b/app/tests/dockBarVisibility.test.js
index e8c3f94158..9ddb9a7639 100644
--- a/app/tests/dockBarVisibility.test.js
+++ b/app/tests/dockBarVisibility.test.js
@@ -100,7 +100,8 @@ const browserCases = async (sources, css, template, animationOnly = false) => {
const rightDockSpace = () => document.documentElement.style.getPropertyValue("--b3-dock-right-width");
const checkRightDockSpace = (message) => {
const reserved = !hidden(rightBar) && !rightBar.classList.contains("dock--float");
- check.equal(rightDockSpace(), reserved ? "var(--b3-ui-dock-width, 42px)" : "0px", message);
+ check.equal(rightDockSpace(), reserved ? "var(--b3-ui-dock-width, 42px)" : "var(--b3-layout-space)",
+ message);
};
checkRightDockSpace("a hidden right bar reserves no space for fixed overlays");
if (animationOnly) {
@@ -490,7 +491,8 @@ const browserCases = async (sources, css, template, animationOnly = false) => {
window.siyuan.config.uiLayout.hideDock = true;
bar.syncDockBarVisibility();
check.ok(hidden(leftBar) && hidden(rightBar));
- check.equal(rightDockSpace(), "0px", "hiding the right bar restores the window edge offset");
+ check.equal(rightDockSpace(), "var(--b3-layout-space)",
+ "hiding the right bar keeps only the editor outer margin for fixed overlays");
check.equal(window.siyuan.config.uiLayout.hideDock, true);
return "Floating dock bar cases passed";
};