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: Retain mobile toolbar history controls while editing mind map nodes https://github.com/siyuan-note/siyuan/issues/20854
Daniela2b114a0a768
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.tsindex 7a2b91bf29..4ef9fbeb56 100644--- a/app/src/mobile/util/keyboardToolbar.ts+++ b/app/src/mobile/util/keyboardToolbar.ts@@ -121,10 +121,6 @@ const applyKeyboardToolbarEntries = (element: HTMLElement, toolbar: Array<stringorder: getEntryOrder(contextPath),isVisible: key => isEntryVisible(`${contextPath}.${key}`),isAvailable: name => {- if ((name === "undo" || name === "redo") &&- protyle?.wysiwyg.element.closest(".mindmap-view__editor")) {- return false;- }if (hasText && (name === "block-type" || MOBILE_TOOLBAR_ACTION_NAMES.includes(name))) {return false;}diff --git a/app/tests/mobileEditingToolbar.test.js b/app/tests/mobileEditingToolbar.test.jsindex ec556247d3..af678791f1 100644--- a/app/tests/mobileEditingToolbar.test.js+++ b/app/tests/mobileEditingToolbar.test.js@@ -202,7 +202,7 @@ const runCases = async (sources, platform, topBarHTML) => {assert.equal(undoCalls, 1);action("heading1");assert.equal(inserts[0], "# ‸");- // 节点编辑使用画布顶部历史入口,切回正文后恢复共享工具栏的历史按钮和原有配置。+ // 编辑导图节点时保留键盘工具栏历史入口,切换编辑器和刷新配置时均遵循显隐设置。const nodeEditor = document.createElement("div");nodeEditor.className = "mindmap-view__editor";const nodeProtyle = document.createElement("div");@@ -225,8 +225,8 @@ const runCases = async (sources, platform, topBarHTML) => {nodeRange.setStart(nodeEditable.firstChild, 0); nodeRange.collapse(true);getSelection().removeAllRanges(); getSelection().addRange(nodeRange);await settle();- assert.equal(hidden("undo"), true);- assert.equal(hidden("redo"), true);+ assert.equal(hidden("undo"), false);+ assert.equal(hidden("redo"), false);assert.equal(toolbar.classList.contains("fn__none"), false, "other keyboard actions stay available");assert.equal(hidden("block"), false);const nodeActions = [...toolbar.querySelector(".keyboard__dynamic").children]@@ -237,8 +237,14 @@ const runCases = async (sources, platform, topBarHTML) => {nodeActions[index + 1]?.classList.contains("keyboard__split")), false);window.dispatchEvent(new Event("siyuan-entry-visibility"));await settle();- assert.equal(hidden("undo"), true, "configuration refresh cannot restore duplicate history controls");- assert.equal(hidden("redo"), true);+ assert.equal(hidden("undo"), false, "configuration refresh retains node editing history controls");+ assert.equal(hidden("redo"), false);+ visible.delete("mobile-redo");+ window.dispatchEvent(new Event("siyuan-entry-visibility"));+ await settle();+ assert.equal(hidden("undo"), false);+ assert.equal(hidden("redo"), true, "node editing respects explicitly hidden history entries");+ visible.add("mobile-redo");nodeEditor.className = "table__cell-editor";await settle();assert.equal(hidden("undo"), false, "standalone cell editors retain their own history controls");@@ -247,7 +253,7 @@ const runCases = async (sources, platform, topBarHTML) => {current = documentEditor;editable.focus(); select(0);await settle();- assert.equal(hidden("undo"), false, "ordinary document history returns after node editing");+ assert.equal(hidden("undo"), false, "ordinary document history remains available after node editing");assert.equal(hidden("redo"), true, "returning to a document preserves explicitly hidden entries");visible.add("mobile-redo");await settle();