An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Refine mobile menu back navigation https://github.com/siyuan-note/siyuan/issues/14648
Daniel88e48ad3c7c4
diff --git a/app/src/assets/scss/component/_menu.scss b/app/src/assets/scss/component/_menu.scssindex 00409a75dd..37053ca511 100644--- a/app/src/assets/scss/component/_menu.scss+++ b/app/src/assets/scss/component/_menu.scss@@ -197,12 +197,20 @@.b3-menu {&__title {+ background-color: transparent;+ border-bottom: 0;box-sizing: border-box;+ color: var(--b3-theme-on-surface-light);height: 56px;padding-top: 8px;position: relative;touch-action: none;+ & > .b3-menu__icon,+ & > .b3-menu__label {+ color: var(--b3-theme-on-surface-light);+ }+&::before {position: absolute;top: 5px;@@ -214,6 +222,16 @@content: "";opacity: .45;}++ &--root {+ height: 16px;+ padding: 0;++ & > .b3-menu__icon,+ & > .b3-menu__label {+ display: none;+ }+ }}&__items {diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.tsindex d73e8cc1ad..7d71d40974 100644--- a/app/src/menus/Menu.ts+++ b/app/src/menus/Menu.ts@@ -94,7 +94,8 @@ export class Menu {const target = event.target as Element;if (isMobile()) {const titleElement = hasClosestByClassName(target, "b3-menu__title");- if (titleElement || (typeof event.detail === "string" && event.detail === "back")) {+ const isSystemBack = typeof event.detail === "string" && event.detail === "back";+ if ((titleElement && !titleElement.classList.contains("b3-menu__title--root")) || isSystemBack) {const lastShowElements = this.element.querySelectorAll(".b3-menu__item--show");if (lastShowElements.length > 0) {lastShowElements[lastShowElements.length - 1].classList.remove("b3-menu__item--show");@@ -308,7 +309,26 @@ export class Menu {fullscreenCloseTimeout = window.setTimeout(() => this.removeImmediately(), Constants.TIMEOUT_DBLCLICK);}+ private updateSheetTitle() {+ if (!this.element.classList.contains("b3-menu--sheet")) {+ return;+ }+ const titleElement = this.element.firstElementChild as HTMLElement;+ const labelElement = titleElement.querySelector(".b3-menu__label") as HTMLElement;+ const shownItems = this.element.querySelectorAll(".b3-menu__item--show");+ if (shownItems.length === 0) {+ titleElement.classList.add("b3-menu__title--root");+ labelElement.textContent = "";+ return;+ }+ titleElement.classList.remove("b3-menu__title--root");+ const parentLabelElement = shownItems[shownItems.length - 1]+ .querySelector(":scope > .b3-menu__label") as HTMLElement;+ labelElement.textContent = parentLabelElement?.textContent.trim() || window.siyuan.languages.back;+ }+private setSheetHeight(position: "bottom" | "all") {+ this.updateSheetTitle();if (position === "bottom") {this.element.style.height = "50vh";return;@@ -446,6 +466,9 @@ export class Menu {}this.removeScrollEvent();this.element.firstElementChild.classList.add("fn__none");+ this.element.firstElementChild.classList.remove("b3-menu__title--root");+ (this.element.firstElementChild.querySelector(".b3-menu__label") as HTMLElement).innerHTML =+ window.siyuan.languages.back;this.element.lastElementChild.innerHTML = "";this.element.lastElementChild.classList.remove("b3-menu__items--menu");this.element.lastElementChild.removeAttribute("style"); // 输入框 focus 后 boxShadow 显示不全