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: Place mind map summary creation beside the selection https://github.com/siyuan-note/siyuan/issues/20803
Daniel7dc31f88ad18
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.syindex 0a26e1c446..ca9e76f2f0 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy@@ -8,7 +8,7 @@"title": "Formatting elements","title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;","type": "doc",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -1961,7 +1961,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091509-v1x69oc",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -3646,7 +3646,7 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-kkcg79g",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -3660,7 +3660,7 @@},{"Type": "NodeText",- "Data": " in the bottom node menu to create summaries immediately, without selecting again or confirming. On desktop, drag on blank canvas or Ctrl/Command-click nodes; on touch screens, enable "+ "Data": " beside the preview bracket on the canvas to create summaries immediately, without selecting again or confirming. For several groups, the button shows how many summaries it will create. On desktop, drag on blank canvas or Ctrl/Command-click nodes; on touch screens, enable "},{"Type": "NodeTextMark",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 cf4a255e59..54c557a94f 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": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -13115,7 +13115,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-4zeuyl4",- "updated": "20261022132341"+ "updated": "20261022134112"},"HeadingLevel": 3,"Children": [@@ -13960,7 +13960,7 @@"Type": "NodeParagraph","Properties": {"id": "20260926152753-8trdt10",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -13974,7 +13974,7 @@},{"Type": "NodeText",- "Data": " in the bottom node menu to create all valid groups in one undoable operation. Esc leaves multi-select mode. While editing summary text, Enter saves and Esc cancels. Delete or Backspace removes the selected summary."+ "Data": " beside the preview bracket on the canvas to create all valid groups in one undoable operation. Esc leaves multi-select mode. While editing summary text, Enter saves and Esc cancels. Delete or Backspace removes the selected summary."}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.syindex a2f88665c1..caf5c9961e 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy@@ -8,7 +8,7 @@"title": "排版元素","title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);","type": "doc",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -1964,7 +1964,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091228-wdpx6ev",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -3649,12 +3649,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-8wl1iml",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{"Type": "NodeText",- "Data": "选中节点后,点击底部节点菜单中的 "+ "Data": "选中节点后,点击画布预览括号旁的 "},{"Type": "NodeTextMark",@@ -3663,7 +3663,7 @@},{"Type": "NodeText",- "Data": " 即可直接创建,无需再次选择或确认。桌面端可在空白画布框选,或按住 Ctrl/Command 点选节点;触屏上先开启顶部工具栏的 "+ "Data": " 即可直接创建,无需再次选择或确认。多组时,按钮显示将创建的概要数量。桌面端可在空白画布框选,或按住 Ctrl/Command 点选节点;触屏上先开启顶部工具栏的 "},{"Type": "NodeTextMark",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 097db05e14..675c1146a7 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": "20261022132551"+ "updated": "20261022134112"},"Children": [{@@ -13097,7 +13097,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-hmrchvc",- "updated": "20261022132551"+ "updated": "20261022134112"},"HeadingLevel": 3,"Children": [@@ -14030,12 +14030,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926152753-tamny2o",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{"Type": "NodeText",- "Data": "选中节点后,激活底部节点菜单中的 "+ "Data": "选中节点后,激活画布预览括号旁的 "},{"Type": "NodeTextMark",diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.syindex 08ee9c1266..af4a1f5157 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy@@ -8,7 +8,7 @@"title": "排版元素","title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);","type": "doc",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -1962,7 +1962,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226122008-731sqd6",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -3647,12 +3647,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-6pycwgr",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{"Type": "NodeText",- "Data": "選取節點後,點選底部節點選單中的 "+ "Data": "選取節點後,點選畫布預覽括號旁的 "},{"Type": "NodeTextMark",@@ -3661,7 +3661,7 @@},{"Type": "NodeText",- "Data": " 即可直接建立,無需再次選取或確認。桌面端可在空白畫布框選,或按住 Ctrl/Command 點選節點;觸控螢幕上先開啟頂部工具列的 "+ "Data": " 即可直接建立,無需再次選取或確認。多組時,按鈕顯示將建立的概要數量。桌面端可在空白畫布框選,或按住 Ctrl/Command 點選節點;觸控螢幕上先開啟頂部工具列的 "},{"Type": "NodeTextMark",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 a246ce6d50..c66cad1444 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": "20261022132551"+ "updated": "20261022134112"},"Children": [{@@ -13103,7 +13103,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-z0oyw36",- "updated": "20261022132551"+ "updated": "20261022134112"},"HeadingLevel": 3,"Children": [@@ -13948,12 +13948,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926152753-0k1m0f6",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{"Type": "NodeText",- "Data": "選取節點後,啟動底部節點選單中的 "+ "Data": "選取節點後,啟動畫布預覽括號旁的 "},{"Type": "NodeTextMark",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 cf45a1ab23..641f9a5b5c 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": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -13053,7 +13053,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-icqlkb6",- "updated": "20261022132341"+ "updated": "20261022134112"},"HeadingLevel": 3,"Children": [@@ -13880,12 +13880,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926152753-5vwcnw1",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{"Type": "NodeText",- "Data": "ノードを選択してから、下部のノードメニューで "+ "Data": "ノードを選択してから、キャンバスのプレビュー括弧の横にある "},{"Type": "NodeTextMark",diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.syindex d1116b79b8..0b004abf2c 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy@@ -9,7 +9,7 @@"title": "書式要素","title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;","type": "doc",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -2090,7 +2090,7 @@"Properties": {"ID": "20240530101000-ch5e4vh","id": "20240530101000-1ev7xub",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{@@ -3778,12 +3778,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-vknoaqd",- "updated": "20261022132341"+ "updated": "20261022134112"},"Children": [{"Type": "NodeText",- "Data": "ノードを選択してから、下部のノードメニューで "+ "Data": "ノードを選択してから、キャンバスのプレビュー括弧の横にある "},{"Type": "NodeTextMark",@@ -3792,7 +3792,7 @@},{"Type": "NodeText",- "Data": " をクリックすると、再選択や確認なしですぐに作成できます。デスクトップでは空白部分をドラッグするか、Ctrl/Command を押しながらノードをクリックします。タッチ画面では上部ツールバーの "+ "Data": " をクリックすると、再選択や確認なしですぐに作成できます。複数グループの場合、ボタンに作成する要約の数が表示されます。デスクトップでは空白部分をドラッグするか、Ctrl/Command を押しながらノードをクリックします。タッチ画面では上部ツールバーの "},{"Type": "NodeTextMark",diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scssindex b62be6cf6a..89fc0cbd4d 100644--- a/app/src/assets/scss/protyle/_mindmap-view.scss+++ b/app/src/assets/scss/protyle/_mindmap-view.scss@@ -817,6 +817,17 @@}}+ &__summary-action {+ position: absolute;+ z-index: 6;+ min-width: 44px;+ min-height: 32px;+ max-width: calc(100% - 16px);+ box-sizing: border-box;+ white-space: normal;+ background-color: var(--b3-theme-background);+ }+&__route-status {position: absolute;bottom: 72px;@@ -917,6 +928,10 @@}@media (any-pointer: coarse) {+ .mindmap-view__summary-action {+ min-height: 44px;+ }+.mindmap-view__route-endpoint {width: 28px;height: 28px;@@ -938,6 +953,7 @@&__route-handle,&__route-status,&__selection-box,+ &__summary-action,&__add-bridge,&__fold,&__add-child {diff --git a/app/src/protyle/render/listMindmap/arrows.test.ts b/app/src/protyle/render/listMindmap/arrows.test.tsindex af9efa0bdd..e36ce1c9a7 100644--- a/app/src/protyle/render/listMindmap/arrows.test.ts+++ b/app/src/protyle/render/listMindmap/arrows.test.ts@@ -70,7 +70,7 @@ const setup = (arrowDirection?: ListMindmapRelation["arrowDirection"]) => {scale: 1, offsetX: 0, offsetY: 0, world: {style: {}}, zoomLabel: {}, zoomSlider: {},viewport: {clientWidth: 400, clientHeight: 200, getBoundingClientRect: () => ({left: 0, top: 0})},canvas: {getContext: () => context}, options: {host: {}}, colorProbe: {style: {}},- inspector: {hidden: true},+ inspector: {hidden: true}, summaryAction: {hidden: true},model: {root: {id: "a"}, metadata: {nodes: {}, relations: [relation]}}, edges: [],positions: new Map([["a", {id: "a", x: 100, y: 0, width: 20, height: 20}],["b", {id: "b", x: -20, y: 0, width: 20, height: 20}]]),diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex 6c02df4ab5..fd9180abe3 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -2162,7 +2162,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.ok(palette.scrollWidth > palette.clientWidth, "long palettes scroll independently");palette.scrollLeft = palette.scrollWidth;const bounds = inspector.getBoundingClientRect();- for (const key of ["connect", "listMindmapSummary", "delete"]) {+ for (const key of ["connect", "delete"]) {const action = inspector.querySelector<HTMLElement>(`[aria-label="${key}"]`).getBoundingClientRect();check.ok(action.left >= bounds.left && action.right <= bounds.right,`node action ${key} stays visible at width ${width} while the palette scrolls`);@@ -4641,13 +4641,18 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,}});await settle();summaryView.focusNode(summaryIds[0]);- const summaryButton = summaryHost.querySelector<HTMLButtonElement>('[aria-label="listMindmapSummary"]');+ const summaryButton = summaryHost.querySelector<HTMLButtonElement>(".mindmap-view__summary-action");check.equal(summaryButton.disabled, false);for (const id of summaryIds.slice(1)) {summaryView.selectNode(id, true);}- summaryButton.click();await settle();+ check.equal(summaryButton.hidden, false);+ check.equal(summaryHost.querySelector('.mindmap-view__inspector [aria-label="listMindmapSummary"]'), null);+ const summaryActionBounds = summaryButton.getBoundingClientRect();+ check.equal(document.elementFromPoint(summaryActionBounds.left + summaryActionBounds.width / 2,+ summaryActionBounds.top + summaryActionBounds.height / 2)?.closest("button"), summaryButton);+ await clickMouse(summaryButton);const summaryInput = summaryHost.querySelector<HTMLInputElement>(".mindmap-view__summary-editor");check.ok(summaryInput, "new summaries enter text editing on touch selection");summaryInput.value = "<script>plain text</script> " + "Long summary ".repeat(25);@@ -4813,6 +4818,8 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(summaryButton.disabled, true, "crossing ranges disable direct creation");check.equal(summaryButton.getAttribute("aria-description"), "listMindmapSummaryConflict");check.equal(summaryView.summaryStatus.hidden, false, "touch users can see why creation is disabled");+ await settle();+ check.equal(summaryButton.hidden, true, "conflicting selections do not expose a creation control");summaryButton.click();check.deepEqual(api.readListMindmap(summaryList).metadata.summaries[0].nodeIds, summaryIds.slice(0, 2));summaryView.clearSelection();@@ -4849,7 +4856,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.ok(printedBounds.bottom <= printViewport.bottom + 1, "PDF previews include tall summary labels");printedLabel.dispatchEvent(new MouseEvent("dblclick", {bubbles: true}));check.equal(summaryHost.querySelector(".mindmap-view__summary-editor"), null);- check.equal(summaryHost.querySelector('[aria-label="listMindmapSummary"]'), null);+ check.equal(summaryHost.querySelector<HTMLButtonElement>(".mindmap-view__summary-action").hidden, true);summaryView.destroy();summaryHost.remove();api.deleteListMindmapNode(summaryList, summaryIds[0]);@@ -4975,10 +4982,29 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,const batchInspector = batchHost.querySelector<HTMLElement>(".mindmap-view__inspector");check.equal(batchInspector.hidden, false);check.equal(batchInspector.querySelector('[aria-label="multiSelect"]'), null);- const batchButton = batchInspector.querySelector<HTMLButtonElement>('[aria-label="listMindmapSummary"]');+ const batchButton = batchHost.querySelector<HTMLButtonElement>(".mindmap-view__summary-action");+ check.equal(batchInspector.querySelector('[aria-label="listMindmapSummary"]'), null);+ await settle();+ check.equal(batchButton.hidden, false);+ check.equal(batchButton.textContent, batchLabels.listMindmapSummaryBatch.replace("${count}", "2"));check.equal(batchButton.disabled, false);check.equal(batchButton.dataset.tooltip, batchLabels.listMindmapSummaryBatch.replace("${count}", "2"));check.equal(batchInspector.querySelector<HTMLButtonElement>('[aria-label="connect"]').disabled, true);+ await moveMouse();+ for (const [background, primary] of [["#ffffff", "#2563eb"], ["#1e1e1e", "#93c5fd"]]) {+ batchHost.style.setProperty("--b3-theme-background", background);+ batchHost.style.setProperty("--b3-theme-primary", primary);+ const colorProbe = document.createElement("span");+ colorProbe.style.color = background;+ batchHost.append(colorProbe);+ check.equal(getComputedStyle(batchButton).backgroundColor, getComputedStyle(colorProbe).color,+ "floating controls retain the theme background in light and dark themes");+ colorProbe.style.color = primary;+ check.equal(getComputedStyle(batchButton).color, getComputedStyle(colorProbe).color);+ colorProbe.remove();+ }+ batchHost.style.removeProperty("--b3-theme-background");+ batchHost.style.removeProperty("--b3-theme-primary");for (const width of [240, 320, 700]) {batchHost.style.width = `${width}px`;batchHost.style.fontSize = "32px";@@ -4992,6 +5018,11 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,}}batchHost.style.fontSize = "";+ const selectedBeforeAction = [...batchView.getSelectedIds()];+ const actionBounds = batchButton.getBoundingClientRect();+ batchButton.dispatchEvent(new PointerEvent("pointerdown", {pointerId: 85, pointerType: "touch", isPrimary: true,+ button: 0, bubbles: true, clientX: actionBounds.left + 1, clientY: actionBounds.top + 1}));+ check.deepEqual(batchView.getSelectedIds(), selectedBeforeAction, "touching the graph action preserves the selection");batchButton.click();await settle();check.equal(batchHistory.length, 1, "clicking summary submits all groups once without a confirmation step");diff --git a/app/src/protyle/render/listMindmap/summaryView.test.ts b/app/src/protyle/render/listMindmap/summaryView.test.tsindex 655feeea78..1d7e5c9093 100644--- a/app/src/protyle/render/listMindmap/summaryView.test.ts+++ b/app/src/protyle/render/listMindmap/summaryView.test.ts@@ -11,8 +11,8 @@ const source = createSourceFile("view.ts", readFileSync("src/protyle/render/listScriptTarget.ES2021, true);const declaration = source.statements.find(item => isClassDeclaration(item) && item.name?.text === "ListMindmapView");assert.ok(declaration && isClassDeclaration(declaration));-const methods = declaration.members.filter(item => ["drawSummaries", "drawSummaryPreview"].includes(item.name?.getText(source)));-assert.equal(methods.length, 2);+const methods = declaration.members.filter(item => ["drawSummaries", "drawSummaryPreview", "positionSummaryAction"].includes(item.name?.getText(source)));+assert.equal(methods.length, 3);const compiled = transpileModule(`class View { ${methods.map(item => item.getText(source)).join("\n")} }globalThis.View = View;`, {compilerOptions: {target: ScriptTarget.ES2021}}).outputText;@@ -36,12 +36,18 @@ test("summary previews and committed paths match across styles, zoom levels andconst model: ListMindmapModel = {list: undefined, root, nodes: new Map([["root", root], ["a", child]]),metadata: {version: 1, nodes: {}, relations: [], connectorStyle}};const positions = new Map([["a", {id: "a", x: 100, y: 40, width: 120, height: 50}]]);- Object.assign(view, {model, positions, summaryPositions: new Map(), getSelectedIds: () => ["a"], inspector: {hidden: false}, options: {}, scale, linePaths: [], summaryElements: new Map()});+ Object.assign(view, {model, positions, summaryPositions: new Map(), getSelectedIds: () => ["a"],+ inspector: {hidden: false, getBoundingClientRect: () => ({left: 0, right: 0, top: 0, bottom: 0})},+ summaryAction: {offsetWidth: 80, offsetHeight: 32, style: {}, setAttribute: () => {}},+ label: (key: string) => key, offsetX: 0, offsetY: 0, getToolbarBounds: (): DOMRect[] => [],+ viewport: {clientWidth: 600, clientHeight: 400, getBoundingClientRect: () => ({left: 0, top: 0, width: 600, height: 400})},+ options: {}, scale, linePaths: [], summaryElements: new Map()});const strokes: PathFixture[] = [];const context = {save: () => {}, restore: () => {}, setLineDash: () => {},stroke: (path: PathFixture) => strokes.push(path)};view.drawSummaryPreview(context, "blue");assert.equal(strokes.length, 1);+ assert.equal(view.summaryAction.hidden, false);const preview = strokes.pop();Object.assign(model.metadata, {summaries: [{...range, id: "summary", label: "Summary"}]});view.summaryPositions = layoutListMindmapSummaries(model, positions,@@ -57,10 +63,46 @@ test("summary previews and committed paths match across styles, zoom levels andview.options.printLayout = true;view.drawSummaryPreview(context, "blue");assert.equal(strokes.length, 0, "creation previews are excluded from exports");+ assert.equal(view.summaryAction.hidden, true, "creation controls are excluded from exports");}}});+test("graph summary actions follow canvas transforms, show the batch count and avoid visible controls", () => {+ const sandbox: any = {};+ runInNewContext(compiled, sandbox);+ const view = new sandbox.View();+ const attributes = new Map<string, string>();+ const action = {hidden: true, offsetWidth: 80, offsetHeight: 32, textContent: "", style: {left: "", top: ""},+ setAttribute: (key: string, value: string) => attributes.set(key, value)};+ const position = {id: "preview", x: 276, labelX: 300, labelY: 150, top: 100, bottom: 200, width: 0, height: 0};+ Object.assign(view, {summaryAction: action, viewport: {clientWidth: 600, clientHeight: 400,+ getBoundingClientRect: () => ({left: 20, top: 30, width: 1200, height: 800})},+ inspector: {hidden: true}, positions: new Map(), summaryPositions: new Map(), getToolbarBounds: (): DOMRect[] => [],+ label: (key: string) => key === "listMindmapSummaryBatch" ? "Create ${count} summaries" : "Summary"});+ for (const scale of [.5, 1, 1.5]) {+ Object.assign(view, {scale, offsetX: 12, offsetY: 20});+ view.positionSummaryAction([position], 1);+ assert.equal(action.hidden, false);+ assert.equal(action.textContent, "Summary");+ assert.equal(parseFloat(action.style.left), 12 + position.labelX * scale);+ assert.equal(parseFloat(action.style.top), 20 + (position.top + position.bottom) * scale / 2 - 16);+ }+ Object.assign(view, {scale: 1, offsetX: 0, offsetY: 0,+ getToolbarBounds: () => [{left: 600, right: 900, top: 270, bottom: 410}]});+ view.positionSummaryAction([position], 3);+ assert.equal(action.textContent, "Create 3 summaries");+ assert.equal(attributes.get("aria-label"), action.textContent);+ assert.equal(parseFloat(action.style.top), 60, "a scaled toolbar moves the action above the selected range");+ view.viewport.clientWidth = 240;+ view.positionSummaryAction([position], 3);+ assert.ok(parseFloat(action.style.left) >= 8);+ assert.ok(parseFloat(action.style.left) + action.offsetWidth <= 232);+ view.viewport.clientWidth = 40;+ view.positionSummaryAction([position], 3);+ assert.equal(action.hidden, true, "an action that cannot fit is not clipped into a misleading hit target");+});+const creation = declaration.members.find(item => item.name?.getText(source) === "createSummary");assert.ok(creation);const creationCode = transpileModule(`class View { ${creation.getText(source)} } globalThis.View = View;`,diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex def2a518c5..2edd84b8d8 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -138,6 +138,7 @@ export class ListMindmapView {private readonly summaryElements = new Map<string, HTMLDivElement>();private summaryPositions = new Map<string, ListMindmapSummaryPosition>();private readonly summaryStatus = createElement("div", "mindmap-view__route-status");+ private readonly summaryAction: HTMLButtonElement;private selectedSummary?: string;private summaryPending = false;private readonly selectionBox = createElement("div", "mindmap-view__selection-box");@@ -220,8 +221,11 @@ export class ListMindmapView {this.inspector = createElement("div", "mindmap-view__inspector");this.inspector.setAttribute("data-prevent-swipe", "true");this.inspector.hidden = true;+ this.summaryAction = this.makeButton("listMindmapSummary", "", () => void this.createSummary());+ this.summaryAction.className = "b3-button b3-button--outline mindmap-view__summary-action";+ this.summaryAction.hidden = true;this.zoomLabel = createElement("span", "mindmap-view__zoom");- this.viewport.append(this.canvas, this.world);+ this.viewport.append(this.canvas, this.world, this.summaryAction);this.tooltip.hidden = true;this.tooltip.setAttribute("role", "tooltip");this.colorProbe.setAttribute("aria-hidden", "true");@@ -398,6 +402,7 @@ export class ListMindmapView {private clearSelection() {this.inspector.hidden = true;this.summaryStatus.hidden = true;+ this.summaryAction.hidden = true;if (!this.selectedId && !this.selectedRelation && !this.selectedEdge && !this.relationFrom &&!this.selectedSummary) {return;@@ -483,6 +488,7 @@ export class ListMindmapView {this.options.host.classList.toggle("mindmap-view--active", value);if (!value) {this.summaryStatus.hidden = true;+ this.summaryAction.hidden = true;const selecting = !!this.relationFrom || this.multiSelect;this.multiSelect = false;this.pinching = false;@@ -517,6 +523,7 @@ export class ListMindmapView {this.finishSummaryEdit?.(false);this.multiSelect = false;this.summaryStatus.hidden = true;+ this.summaryAction.hidden = true;this.cancelPointer();this.relationFrom = undefined;this.inspector.hidden = true;@@ -539,6 +546,7 @@ export class ListMindmapView {}private createToolbar() {+ this.buttons.set("summary", this.summaryAction);const controls = createElement("div", "mindmap-view__toolbar-group");const add = (id: string, key: string, icon: string, action: () => void, nodeAction = false) => {const button = this.makeButton(key, icon, action);@@ -585,7 +593,6 @@ export class ListMindmapView {this.updateSelection();});this.buttons.get("multiSelect").setAttribute("aria-pressed", String(this.multiSelect));- add("summary", "listMindmapSummary", "iconGroups", () => void this.createSummary(), true);add("relation", "connect", "iconRoute", () => {this.setInteractionActive(true);this.setPanning(false);@@ -1417,10 +1424,12 @@ export class ListMindmapView {private drawSummaryPreview(context: CanvasRenderingContext2D, color: string) {if (this.readOnly || this.inspector.hidden || this.printTransform || this.options.printLayout) {+ this.summaryAction.hidden = true;return;}const {ranges, conflict} = getListMindmapSummarySelection(this.model, new Set(this.getSelectedIds()));if (conflict || !ranges.length) {+ this.summaryAction.hidden = true;return;}const previews = ranges.map((range, index) => ({...range, id: `preview:${index}`, label: ""}));@@ -1442,6 +1451,60 @@ export class ListMindmapView {}});context.restore();+ const anchor = ranges.findIndex(range => range.nodeIds.includes(this.selectedId));+ const ordered = anchor < 1 ? previews : [previews[anchor], ...previews.filter((_preview, index) => index !== anchor)];+ this.positionSummaryAction(ordered.map(preview => positions.get(preview.id)).filter(Boolean), ranges.length);+ }++ private positionSummaryAction(positions: ListMindmapSummaryPosition[], count: number) {+ const action = this.summaryAction;+ const width = this.viewport.clientWidth;+ const height = this.viewport.clientHeight;+ if (!positions.length || width < 32 || height < 32) {+ action.hidden = true;+ return;+ }+ const label = count === 1 ? this.label("listMindmapSummary") :+ this.label("listMindmapSummaryBatch").replace("${count}", String(count));+ if (action.textContent !== label) {+ action.textContent = label;+ }+ action.setAttribute("aria-label", label);+ action.hidden = false;+ const actionWidth = action.offsetWidth;+ const actionHeight = action.offsetHeight;+ if (actionWidth > width - 16 || actionHeight > height - 16) {+ action.hidden = true;+ return;+ }+ const viewport = this.viewport.getBoundingClientRect();+ const scaleX = viewport.width / width || 1;+ const scaleY = viewport.height / height || 1;+ const controls = [...this.getToolbarBounds(), ...(!this.inspector.hidden ? [this.inspector.getBoundingClientRect()] : [])]+ .map(rect => ({left: (rect.left - viewport.left) / scaleX, top: (rect.top - viewport.top) / scaleY,+ right: (rect.right - viewport.left) / scaleX, bottom: (rect.bottom - viewport.top) / scaleY}));+ const content = [...this.positions.values(), ...[...this.summaryPositions.values()].map(summary =>+ ({x: summary.labelX, y: summary.labelY, width: summary.width, height: summary.height}))];+ const nodes = content.map(node => ({left: this.offsetX + node.x * this.scale,+ top: this.offsetY + node.y * this.scale, right: this.offsetX + (node.x + node.width) * this.scale,+ bottom: this.offsetY + (node.y + node.height) * this.scale}));+ const overlap = (x: number, y: number, rect: {left: number, top: number, right: number, bottom: number}) =>+ Math.max(0, Math.min(x + actionWidth + 4, rect.right) - Math.max(x - 4, rect.left)) *+ Math.max(0, Math.min(y + actionHeight + 4, rect.bottom) - Math.max(y - 4, rect.top));+ const candidates = positions.flatMap(position => {+ const x = this.offsetX + position.labelX * this.scale;+ const top = this.offsetY + position.top * this.scale;+ const bottom = this.offsetY + position.bottom * this.scale;+ return [{x, y: (top + bottom - actionHeight) / 2}, {x, y: top - actionHeight - 8}, {x, y: bottom + 8}];+ }).map(point => {+ const x = Math.max(8, Math.min(width - actionWidth - 8, point.x));+ const y = Math.max(8, Math.min(height - actionHeight - 8, point.y));+ return {x, y, score: controls.reduce((sum, rect) => sum + overlap(x, y, rect), 0) * 1000 ++ nodes.reduce((sum, rect) => sum + overlap(x, y, rect), 0)};+ });+ const best = candidates.reduce((best, point) => point.score < best.score ? point : best);+ action.style.left = `${best.x}px`;+ action.style.top = `${best.y}px`;}private updateRelations() {@@ -3454,7 +3517,7 @@ export class ListMindmapView {const remove = squareButton("delete", "iconTrashcan", () => this.deleteSelection());remove.disabled = ids.includes(this.model.root.id) ||this.model.root.virtual && this.model.root.children.every(node => ids.includes(node.id));- this.inspector.append(this.buttons.get("relation"), this.buttons.get("summary"), remove);+ this.inspector.append(this.buttons.get("relation"), remove);const change = (patch: Partial<ListMindmapNodeStyle>) => multiple ? this.options.onNodesStyle?.(ids, patch) :this.options.onNodeStyle?.(id, patch);const nodePalette = createElement("div", "mindmap-view__palette");