An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Improve mind map navigation across parent branches https://github.com/siyuan-note/siyuan/issues/20622
Daniel43e07fe43bfb
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.syindex b16e83254c..f9a5d69d7a 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy@@ -7,7 +7,7 @@"id": "20200924100950-9op5xi1","title": "Shortcuts","type": "doc",- "updated": "20261016202856"+ "updated": "20261017003000"},"Children": [{@@ -13115,7 +13115,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-4zeuyl4",- "updated": "20261003225941"+ "updated": "20261017003000"},"HeadingLevel": 3,"Children": [@@ -13130,7 +13130,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-3srqnh0",- "updated": "20261003225941",+ "updated": "20261017003000","colgroup": "|"},"TableAligns": [@@ -13449,7 +13449,7 @@"Children": [{"Type": "NodeText",- "Data": "Select the previous sibling node"+ "Data": "Select the previous visible node at the same depth, across parents"}]},@@ -13476,7 +13476,7 @@"Children": [{"Type": "NodeText",- "Data": "Select the next sibling node"+ "Data": "Select the next visible node at the same depth, across parents"}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.syindex 61af3081d1..2752fd806e 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy@@ -7,7 +7,7 @@"id": "20200813004551-gm0pbn1","title": "快捷键","type": "doc",- "updated": "20261016202635"+ "updated": "20261017003000"},"Children": [{@@ -13097,7 +13097,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-hmrchvc",- "updated": "20261003225941"+ "updated": "20261017003000"},"HeadingLevel": 3,"Children": [@@ -13112,7 +13112,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-fr0uxw6",- "updated": "20261003225941",+ "updated": "20261017003000","colgroup": "|"},"TableAligns": [@@ -13479,7 +13479,7 @@"Children": [{"Type": "NodeText",- "Data": "选中上一个同级节点"+ "Data": "选中上一个可见的同深度节点,可跨父节点"}]},@@ -13514,7 +13514,7 @@"Children": [{"Type": "NodeText",- "Data": "选中下一个同级节点"+ "Data": "选中下一个可见的同深度节点,可跨父节点"}]},diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.syindex 07616bb37b..66524d942a 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy@@ -7,7 +7,7 @@"id": "20211226122549-jktxego","title": "快捷鍵","type": "doc",- "updated": "20261016202635"+ "updated": "20261017003000"},"Children": [{@@ -13103,7 +13103,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-z0oyw36",- "updated": "20261003225941"+ "updated": "20261017003000"},"HeadingLevel": 3,"Children": [@@ -13118,7 +13118,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-f8y6pxv",- "updated": "20261003225941",+ "updated": "20261017003000","colgroup": "|"},"TableAligns": [@@ -13437,7 +13437,7 @@"Children": [{"Type": "NodeText",- "Data": "選取上一個同級節點"+ "Data": "選取上一個可見的同深度節點,可跨父節點"}]},@@ -13464,7 +13464,7 @@"Children": [{"Type": "NodeText",- "Data": "選取下一個同級節點"+ "Data": "選取下一個可見的同深度節點,可跨父節點"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.syindex 60e1a7c500..576d32e077 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy@@ -9,7 +9,7 @@"id": "20240530101000-xsbxokr","title": "ショートカット","type": "doc",- "updated": "20261016202856"+ "updated": "20261017003000"},"Children": [{@@ -13053,7 +13053,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-icqlkb6",- "updated": "20261003225941"+ "updated": "20261017003000"},"HeadingLevel": 3,"Children": [@@ -13068,7 +13068,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-01k7syf",- "updated": "20261003225941",+ "updated": "20261017003000","colgroup": "|"},"TableAligns": [@@ -13387,7 +13387,7 @@"Children": [{"Type": "NodeText",- "Data": "同じ親を持つ前のノードを選択"+ "Data": "親をまたいで同じ深さの前の可視ノードを選択"}]},@@ -13414,7 +13414,7 @@"Children": [{"Type": "NodeText",- "Data": "同じ親を持つ次のノードを選択"+ "Data": "親をまたいで同じ深さの次の可視ノードを選択"}]},diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex 5f67a0ab41..5c195267cf 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -2323,6 +2323,28 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,await settle();};await settle();+ const navigateSibling = (key: string, expected: string) => {+ const event = new KeyboardEvent("keydown", {key, bubbles: true, cancelable: true});+ siblingHost.dispatchEvent(event);+ check.equal(event.defaultPrevented, true);+ check.equal(siblingView.selectedId, expected);+ };+ siblingView.focusNode(a.id);+ navigateSibling("ArrowUp", a.id);+ navigateSibling("ArrowDown", b.id);+ navigateSibling("ArrowDown", leaf.id);+ navigateSibling("ArrowDown", c.id);+ navigateSibling("ArrowDown", c.id);+ navigateSibling("ArrowUp", leaf.id);+ siblingView.focusNode(deep.id);+ navigateSibling("ArrowDown", b.children[0].id);+ navigateSibling("ArrowDown", c.children[0].id);+ navigateSibling("ArrowUp", b.children[0].id);+ await clickSiblingFold(b.id, false);+ siblingView.focusNode(deep.id);+ navigateSibling("ArrowDown", c.children[0].id);+ navigateSibling("ArrowUp", deep.id);+ await clickSiblingFold(b.id, false);await clickSiblingFold(a.id, false);check.equal(siblingElement(deep.id).hidden, true, "ordinary clicks only fold the clicked node");check.equal(siblingElement(b.children[0].id).hidden, false);diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 3227340811..9981f0b0ab 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -2986,9 +2986,17 @@ export class ListMindmapView {if (!(this.folded.get(node.id) ?? node.collapsed)) {next = node.children[0]?.id;}- } else if (parent) {- const index = parent.children.findIndex(child => child.id === node.id);- next = parent.children[index + (event.key === "ArrowUp" ? -1 : 1)]?.id;+ } else {+ // 按层遍历可见节点,让上下导航跨越父节点,并跳过折叠分支。+ let level = [this.model.root];+ while (level.length) {+ const index = level.findIndex(item => item.id === node.id);+ if (index >= 0) {+ next = level[index + (event.key === "ArrowUp" ? -1 : 1)]?.id;+ break;+ }+ level = level.flatMap(item => (this.folded.get(item.id) ?? item.collapsed) ? [] : item.children);+ }}if (next) {this.selectNode(next);