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: Restore parent navigation in mobile menu profiles https://github.com/siyuan-note/siyuan/issues/20454
Daniel0128231b95b8
diff --git a/app/src/config/entryVisibility/mobileUi.test.ts b/app/src/config/entryVisibility/mobileUi.test.tsindex c845855dc4..6833be448e 100644--- a/app/src/config/entryVisibility/mobileUi.test.ts+++ b/app/src/config/entryVisibility/mobileUi.test.ts@@ -96,6 +96,42 @@ const browserCases = async (sources: Record<string, string>, languages: Record<sui.open(root, id);return document.querySelector<HTMLElement>(".config-entry-visibility__view");};+ const checkMobileNavigation = (editor: HTMLElement, editable: boolean) => {+ const browser = editor.querySelector<HTMLElement>("[data-type='entry-browser']");+ check(!browser.querySelector("[data-action='back-entry']"), "Root column must not offer a parent navigation action");+ const saved = JSON.stringify(config());+ for (const context of ["mobile-input", "mobile-selection"]) {+ const selector = `[data-entry-path-row='editor.toolbar.${context}']`;+ browser.querySelector<HTMLElement>(selector).click();+ const column = browser.querySelector<HTMLElement>("[data-entry-column]:last-child");+ const back = column.querySelector<HTMLElement>("[data-action='back-entry']");+ check(back, "Both mobile toolbar contexts must offer a return to their parent");+ const rect = back.getBoundingClientRect();+ const target = document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);+ check(target && back.contains(target), "Return control must be reachable in the visible column");+ const control = column.querySelector<HTMLInputElement>("input[data-entry-path]:not([disabled])");+ const entryPath = control.dataset.entryPath;+ const checked = control.checked;+ if (editable) {+ control.click();+ }+ browser.querySelector<HTMLElement>("[data-entry-column]:last-child [data-action='back-entry'] svg").dispatchEvent(+ new MouseEvent("click", {bubbles: true}));+ check(browser.querySelectorAll("[data-entry-column]").length === 1,+ "Returning from a context must restore the root column");+ check(browser.querySelector(selector).getBoundingClientRect().width > 0,+ "Context choices must remain available after returning");+ check(editor.classList.contains("config__view--show"), "Returning a level must keep the profile editor open");+ browser.querySelector<HTMLElement>(selector).click();+ const updated = browser.querySelector<HTMLInputElement>(`[data-entry-column]:last-child input[data-entry-path='${entryPath}']`);+ check(updated.checked === (editable ? !checked : checked), "Returning must retain draft visibility changes");+ if (editable) {+ updated.click();+ }+ browser.querySelector<HTMLElement>("[data-entry-column]:last-child [data-action='back-entry']").click();+ }+ check(JSON.stringify(config()) === saved, "Navigating levels must preserve saved profiles and unknown order slots");+ };if (mobileBuild) {root.innerHTML = ui.genEntryVisibilityHtml();ui.mountEntryVisibility(root);@@ -113,6 +149,7 @@ const browserCases = async (sources: Record<string, string>, languages: Record<scheck(editor?.querySelector("[data-type='entry-section']"), "Profile cards must open the mobile editor");check(Boolean(editor.querySelector("[data-action='confirm']")) === (id === "custom"),"Built-in profiles must remain read-only and custom profiles editable");+ checkMobileNavigation(editor, id === "custom");const section = editor.querySelector<HTMLSelectElement>("[data-type='entry-section']");section.value = "editor.slash";section.dispatchEvent(new Event("change", {bubbles: true}));@@ -138,6 +175,7 @@ const browserCases = async (sources: Record<string, string>, languages: Record<sreturn "Mobile compiled settings passed";}let view = open();+ checkMobileNavigation(view, true);const selectSlash = () => {const select = view.querySelector<HTMLSelectElement>("[data-type='entry-section']");select.value = "editor.image";@@ -153,6 +191,7 @@ const browserCases = async (sources: Record<string, string>, languages: Record<sview = open(id);check(Boolean(view.querySelector("[data-profile-field='template']")) === !id,"New profiles must include the template selector");+ checkMobileNavigation(view, true);selectSlash();view.querySelector<HTMLInputElement>("[data-entry-path='editor.slash.menu']").click();const list = view.querySelector<HTMLElement>(".config-entry-visibility__column-list");diff --git a/app/src/config/entryVisibility/ui.ts b/app/src/config/entryVisibility/ui.tsindex c79eb46626..12869dcec0 100644--- a/app/src/config/entryVisibility/ui.ts+++ b/app/src/config/entryVisibility/ui.ts@@ -320,6 +320,10 @@ const renderEntryColumn = (profile: Config.IEntryVisibilityProfile, title: stringetItemPath = (item: IEntryCatalogNode) => `${prefix}.${item.key}`) => `<section class="config-entry-visibility__column"data-entry-column data-entry-depth="${depth}"><div class="config-entry-visibility__column-title">+ ${isMobile() && depth > 0 ? `<button class="block__icon block__icon--show" data-action="back-entry"+ data-entry-parent="${escapeAttr(prefix)}" aria-label="${escapeAttr(window.siyuan.languages.back)}">+ <svg><use xlink:href="#iconLeft"></use></svg>+ </button>` : ""}<span class="fn__ellipsis fn__flex-1" title="${escapeAttr(title)}">${escapeHtml(title)}</span>${sortable ? renderOrderReset(prefix) : ""}</div>@@ -965,6 +969,9 @@ const openProfileEditor = (root: HTMLElement, profileID?: string) => {selectedPaths = selectedPaths.slice(0, depth);selectedPaths[depth] = actionElement.dataset.entryPath;renderBrowser(true);+ } else if (action === "back-entry") {+ selectedPaths = getEntryCatalogPathChain(selectedSectionKey, actionElement.dataset.entryParent).slice(0, -1);+ renderBrowser(true);} else if (!builtin && action === "confirm") {const nameInput = view.querySelector<HTMLInputElement>("[data-profile-field='name']");const name = draft.name.trim();