An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Preserve mobile notification spacing https://github.com/siyuan-note/siyuan/issues/20895
Daniel24c639fca311
diff --git a/app/src/assets/scss/main/_mobile.scss b/app/src/assets/scss/main/_mobile.scssindex 2993ba24ee..b668a690df 100644--- a/app/src/assets/scss/main/_mobile.scss+++ b/app/src/assets/scss/main/_mobile.scss@@ -3,6 +3,9 @@@use "../component/svg";body {+ --b3-snackbar-gap: 16px;+ --b3-snackbar-right: 30px;+ --b3-snackbar-top: max(22px, calc(var(--b3-window-controls-height, 0px) + 16px));--mobile-top-safe-area: env(safe-area-inset-top);--mobile-topbar-height: 48px;--mobile-breadcrumb-height: 42px;@@ -2040,6 +2043,12 @@ body.mobile-topbar--merged {--b3-snackbar-top: calc(var(--mobile-top-safe-area) + 35px);}+@media (max-width: 520px) {+ .b3-snackbars {+ --b3-snackbar-right: calc(10vw - 18px);+ }+}+.b3-menu--fullscreen:not(.b3-menu--sheet) {padding-top: var(--mobile-top-safe-area);diff --git a/app/tests/snackbarPosition.test.js b/app/tests/snackbarPosition.test.jsindex 0d8c88c3d9..3b6ae77b7e 100644--- a/app/tests/snackbarPosition.test.js+++ b/app/tests/snackbarPosition.test.js@@ -17,6 +17,11 @@ const cases = async (source, css, densityCSS, mobileCSS) => {const near = (actual, expected, message) =>check.ok(Math.abs(actual - expected) <= 1, `${message}: ${actual} vs ${expected}`);const root = document.documentElement;+ const resize = async width => {+ await require("electron").ipcRenderer.invoke("resize", width);+ await new Promise(resolve => requestAnimationFrame(resolve));+ check.equal(innerWidth, width, "the renderer has applied the window resize");+ };for (const compact of [false, true]) {if (compact) {root.setAttribute("data-ui-density", "compact");@@ -26,7 +31,7 @@ const cases = async (source, css, densityCSS, mobileCSS) => {for (const fused of [false, true]) {document.body.classList.toggle("body--toolbar-hide", fused);for (const width of [900, 420]) {- await require("electron").ipcRenderer.invoke("resize", width);+ await resize(width);const narrowRight = width <= 520 ? width * 0.1 - 18 : 0;for (const dock of [0, 34, 42]) {root.style.setProperty("--b3-dock-right-width", `${dock}px`);@@ -70,12 +75,25 @@ const cases = async (source, css, densityCSS, mobileCSS) => {root.style.removeProperty("--b3-dock-right-width");style.textContent += mobileCSS;document.body.innerHTML = '<div id="message" class="b3-snackbars"></div>';- for (const safeTop of [0, 44]) {- document.body.style.setProperty("--mobile-top-safe-area", `${safeTop}px`);- const container = document.getElementById("message");- check.equal(container.getBoundingClientRect().top, safeTop + 35, "mobile notifications retain their safe-area offset");- check.ok(container.getBoundingClientRect().top + parseFloat(getComputedStyle(container).maxHeight) <=- innerHeight - gap + 1, "mobile notifications keep the bottom gap");+ for (const width of [900, 420]) {+ await resize(width);+ for (const safeTop of [0, 44]) {+ document.body.style.setProperty("--mobile-top-safe-area", `${safeTop}px`);+ document.body.innerHTML = '<div id="message" class="b3-snackbars"></div>';+ showMessage("Startup notification", 0);+ const startupStyle = getComputedStyle(document.getElementById("tempMessage"));+ near(parseFloat(startupStyle.top), 22, "mobile startup notifications retain their top offset");+ near(parseFloat(startupStyle.right), 30, "mobile startup notifications retain their right offset");+ initMessage();+ await new Promise(resolve => setTimeout(resolve, 0));+ const container = document.getElementById("message");+ const rect = container.getBoundingClientRect();+ near(rect.top, safeTop + 35, "mobile notifications retain their safe-area offset");+ near(innerWidth - rect.right, width <= 520 ? width * 0.1 - 18 : 30,+ "mobile notifications retain their wide and narrow window margins");+ near(innerHeight - rect.top - parseFloat(getComputedStyle(container).maxHeight), 16,+ "mobile notifications retain their bottom gap");+ }}return "Snackbar positioning passed";};@@ -85,7 +103,7 @@ if (process.versions.electron && process.type === "browser") {const {app, BrowserWindow, ipcMain} = require("electron");app.setPath("userData", process.argv[2]);await app.whenReady();- const win = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true, contextIsolation: false}});+ const win = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true, contextIsolation: false, backgroundThrottling: false}});ipcMain.handle("resize", (_event, width) => win.setContentSize(width, 600));await win.loadURL("data:text/html,<html><body></body></html>");const ts = require("typescript");