Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve mind map summary creation from selected nodes https://github.com/siyuan-note/siyuan/issues/20803

Daniel0a22830dbd5c
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.sy
index f0367be8be..0a26e1c446 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": "20261022122318"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -1961,7 +1961,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210104091509-v1x69oc",
- "updated": "20261021132218"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -2270,12 +2270,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022102848-5nohuq1",
- "updated": "20261022102848"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "Select multiple nodes, then use the bottom palette to change their text and background colors together. The branch line palette changes the incoming hierarchy lines of the selected nodes. Each batch change can be undone in one step. Choose Default in a palette to restore the theme or default colors. On touch screens, use the multiple-selection button in the bottom node menu to select the nodes."
+ "Data": "Select multiple nodes, then use the bottom palette to change their text and background colors together. The branch line palette changes the incoming hierarchy lines of the selected nodes. Each batch change can be undone in one step. Choose Default in a palette to restore the theme or default colors. On touch screens, use the Multi-select button in the top toolbar to select the nodes."
}
]
},
@@ -3646,12 +3646,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926151827-kkcg79g",
- "updated": "20261020162345"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "Select the first node in a range, click "
+ "Data": "Select nodes, then click "
},
{
"Type": "NodeTextMark",
@@ -3660,7 +3660,16 @@
},
{
"Type": "NodeText",
- "Data": " in the bottom node menu, then select the last sibling node to add a bracket and summary text. The range must be contiguous. Single-node summaries and nested ranges are supported; ranges may contain each other but must not cross. The bracket encloses the visible subtree and any inner summaries. To create several summaries, activate Summary and drag a selection on blank canvas. You can also tap blank canvas, then tap nodes individually. The preview groups consecutive selected siblings by parent; selected ancestors take precedence over their descendants. Existing identical summaries are skipped, and crossing ranges prevent creation. Use the confirm button or Enter to create all previewed groups in one undoable operation; Esc cancels. Document updates cancel a pending selection. These steps also work on mobile. You can also use the up and down arrow keys to select the last node, Enter to confirm the range, and Esc to cancel."
+ "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 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Multi-select"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " in the top toolbar, then tap nodes. Consecutive selected siblings form one summary; separate ranges and different parents form separate summaries, without including unselected nodes. Selected ancestors take precedence over their descendants. Single-node and nested summaries are supported. Existing identical summaries are skipped; crossing ranges disable creation and show a warning. The bracket encloses the visible subtree and inner summaries. All groups are created in one undoable operation. Unavailable node actions are disabled. Esc leaves multi-select mode."
}
]
},
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.sy
index 4a0b3fd7ab..cf4a255e59 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": "20261020181700"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -13115,7 +13115,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260921105011-4zeuyl4",
- "updated": "20261020181700"
+ "updated": "20261022132341"
},
"HeadingLevel": 3,
"Children": [
@@ -13129,12 +13129,13 @@
"ID": "20261018163000-tgvsr1a",
"Type": "NodeParagraph",
"Properties": {
- "id": "20261018163000-tgvsr1a"
+ "id": "20261018163000-tgvsr1a",
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "Press Esc on the canvas to return to reading and let the document receive wheel input. If a node editor, summary selection, or relationship-line drag is active, Esc first finishes or cancels that operation. In full screen, Esc exits full screen."
+ "Data": "Press Esc on the canvas to return to reading and let the document receive wheel input. If a node editor or relationship-line drag is active, Esc first finishes or cancels that operation. Esc also leaves multi-select mode. In full screen, Esc exits full screen."
}
]
},
@@ -13959,12 +13960,21 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926152753-8trdt10",
- "updated": "20260926152753"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "In the summary batch preview, Enter creates all groups in one undoable operation and Esc cancels. While selecting a summary range, use the up and down arrow keys to select the last sibling node, Enter to confirm, and Esc to cancel. While editing summary text, Enter saves and Esc cancels. Delete or Backspace removes the selected summary."
+ "Data": "Select nodes, then activate "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Summary"
+ },
+ {
+ "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."
}
]
},
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.sy
index 548085dcef..a2f88665c1 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": "20261022122318"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -1964,7 +1964,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210104091228-wdpx6ev",
- "updated": "20261021132218"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -2273,12 +2273,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022102848-xfgxiox",
- "updated": "20261022102848"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "选中多个节点后,可用底部色板统一修改文字和背景颜色,也可用分支连线色板修改所选节点的入线颜色。每次批量修改均可一次撤销。在对应色板中选择默认,可恢复主题或默认配色。触屏上可使用底部节点菜单的多选按钮选择多个节点。"
+ "Data": "选中多个节点后,可用底部色板统一修改文字和背景颜色,也可用分支连线色板修改所选节点的入线颜色。每次批量修改均可一次撤销。在对应色板中选择默认,可恢复主题或默认配色。触屏上可使用顶部工具栏的多选按钮选择多个节点。"
}
]
},
@@ -3649,12 +3649,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926151827-8wl1iml",
- "updated": "20261020162345"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "选中范围的第一个节点,点击底部节点菜单中的 "
+ "Data": "选中节点后,点击底部节点菜单中的 "
},
{
"Type": "NodeTextMark",
@@ -3663,7 +3663,16 @@
},
{
"Type": "NodeText",
- "Data": ",再选择末端同级节点,即可添加方括号和概要文字。范围必须连续,支持单节点概要和范围嵌套,范围可以相互包含,但不能交叉。括号包围可见子树及内层概要。批量创建时,点击概要按钮后在画布空白处框选;也可以先点击空白处,再逐个点选节点。预览按父节点和连续范围分组,父子同时选中时以最外层节点为准。已有相同概要会跳过,交叉范围会阻止创建。点击确认按钮或按 Enter 一次创建全部预览概要,并可一次撤销;Esc 取消。文档更新会取消待确认的选择。移动端也可按相同步骤操作。选择范围时也可使用上下方向键选择末端节点,Enter 确认范围,Esc 取消。"
+ "Data": " 即可直接创建,无需再次选择或确认。桌面端可在空白画布框选,或按住 Ctrl/Command 点选节点;触屏上先开启顶部工具栏的 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "多选"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ",再逐个点选节点。同一父节点下连续的选中节点生成一个概要,不连续或不同父节点下的选区分别生成多个概要,不会纳入未选节点。父子同时选中时以最外层节点为准。支持单节点概要和范围嵌套,已有相同概要会跳过;范围交叉时禁用创建并显示提示。括号包围可见子树及内层概要。全部分组一次创建,并可一次撤销。节点菜单中不适用的操作置灰,Esc 退出多选模式。"
}
]
},
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.sy
index f7fc86395c..097db05e14 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": "20261020181700"
+ "updated": "20261022132551"
},
"Children": [
{
@@ -13097,7 +13097,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260921105011-hmrchvc",
- "updated": "20261020181700"
+ "updated": "20261022132551"
},
"HeadingLevel": 3,
"Children": [
@@ -13111,12 +13111,13 @@
"ID": "20261018163000-7w2zbxu",
"Type": "NodeParagraph",
"Properties": {
- "id": "20261018163000-7w2zbxu"
+ "id": "20261018163000-7w2zbxu",
+ "updated": "20261022132551"
},
"Children": [
{
"Type": "NodeText",
- "Data": "在画布上按 Esc 可恢复阅读,让滚轮滚动文档。如果正在编辑节点、选择概括范围或拖动关系线,Esc 会先结束或取消当前操作;全屏时按 Esc 退出全屏。"
+ "Data": "在画布上按 Esc 可恢复阅读,让滚轮滚动文档。如果正在编辑节点或拖动关系线,Esc 会先结束或取消当前操作;Esc 也可退出多选模式;全屏时按 Esc 退出全屏。"
}
]
},
@@ -14029,12 +14030,21 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926152753-tamny2o",
- "updated": "20260926152753"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "批量概要预览中,Enter 一次创建所有分组概要,Esc 取消,创建后可一次撤销。选择概要范围时,使用上下方向键选择末端同级节点,Enter 确认,Esc 取消。编辑概要文字时,Enter 保存,Esc 取消。选中概要后,Delete 或 Backspace 删除概要。"
+ "Data": "选中节点后,激活底部节点菜单中的 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "概要"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 可一次创建所有有效分组,并可一次撤销。Esc 退出多选模式。编辑概要文字时,Enter 保存,Esc 取消。选中概要后,Delete 或 Backspace 删除概要。"
}
]
},
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.sy
index 4e3ce8ce5b..08ee9c1266 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": "20261022122318"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -1962,7 +1962,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20211226122008-731sqd6",
- "updated": "20261021132218"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -2271,12 +2271,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022102848-bttpd92",
- "updated": "20261022102848"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "選取多個節點後,可用底部色板統一修改文字和背景顏色,也可用分支連線色板修改所選節點的入線顏色。每次批次修改均可一次復原。在對應色板中選擇預設,可恢復主題或預設配色。觸控螢幕上可使用底部節點選單的多選按鈕選取多個節點。"
+ "Data": "選取多個節點後,可用底部色板統一修改文字和背景顏色,也可用分支連線色板修改所選節點的入線顏色。每次批次修改均可一次復原。在對應色板中選擇預設,可恢復主題或預設配色。觸控螢幕上可使用頂部工具列的多選按鈕選取多個節點。"
}
]
},
@@ -3647,12 +3647,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926151827-6pycwgr",
- "updated": "20261020162345"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "選取範圍的第一個節點,點選底部節點選單中的 "
+ "Data": "選取節點後,點選底部節點選單中的 "
},
{
"Type": "NodeTextMark",
@@ -3661,7 +3661,16 @@
},
{
"Type": "NodeText",
- "Data": ",再選擇末端同層節點,即可新增方括號與概要文字。範圍必須連續,支援單節點概要和範圍巢狀包含,範圍可以相互包含,但不能交叉。括號包圍可見子樹及內層概要。批次建立時,點選概要按鈕後在畫布空白處框選;也可以先點選空白處,再逐一選取節點。預覽依父節點和連續範圍分組,同時選取父子節點時以最外層節點為準。既有相同概要會略過,交叉範圍會阻止建立。點選確認按鈕或按 Enter 一次建立全部預覽概要,並可一次復原;Esc 取消。文件更新會取消待確認的選取範圍。行動端也可依相同步驟操作。選擇範圍時也可使用上下方向鍵選擇末端節點,Enter 確認範圍,Esc 取消。"
+ "Data": " 即可直接建立,無需再次選取或確認。桌面端可在空白畫布框選,或按住 Ctrl/Command 點選節點;觸控螢幕上先開啟頂部工具列的 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "多選"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ",再逐一點選節點。同一父節點下連續的選取節點產生一個概要,不連續或不同父節點下的選取範圍分別產生多個概要,不會納入未選節點。同時選取父子節點時以最外層節點為準。支援單節點概要和範圍巢狀包含,既有相同概要會略過;範圍交叉時停用建立並顯示提示。括號包圍可見子樹及內層概要。全部分組一次建立,並可一次復原。節點選單中不適用的操作會停用,Esc 結束多選模式。"
}
]
},
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.sy
index ca06db386d..a246ce6d50 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": "20261020181700"
+ "updated": "20261022132551"
},
"Children": [
{
@@ -13103,7 +13103,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260921105011-z0oyw36",
- "updated": "20261020181700"
+ "updated": "20261022132551"
},
"HeadingLevel": 3,
"Children": [
@@ -13117,12 +13117,13 @@
"ID": "20261018163000-e1khci4",
"Type": "NodeParagraph",
"Properties": {
- "id": "20261018163000-e1khci4"
+ "id": "20261018163000-e1khci4",
+ "updated": "20261022132551"
},
"Children": [
{
"Type": "NodeText",
- "Data": "在畫布上按 Esc 可恢復閱讀,讓滾輪捲動文件。如果正在編輯節點、選取摘要範圍或拖曳關係線,Esc 會先結束或取消目前操作;全螢幕時按 Esc 離開全螢幕。"
+ "Data": "在畫布上按 Esc 可恢復閱讀,讓滾輪捲動文件。如果正在編輯節點或拖曳關係線,Esc 會先結束或取消目前操作;Esc 也可結束多選模式;全螢幕時按 Esc 離開全螢幕。"
}
]
},
@@ -13947,12 +13948,21 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926152753-0k1m0f6",
- "updated": "20260926152753"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "批次概要預覽中,Enter 一次建立所有分組概要,Esc 取消,建立後可一次復原。選擇概要範圍時,使用上下方向鍵選擇末端同層節點,Enter 確認,Esc 取消。編輯概要文字時,Enter 儲存,Esc 取消。選取概要後,Delete 或 Backspace 刪除概要。"
+ "Data": "選取節點後,啟動底部節點選單中的 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "概要"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 可一次建立所有有效分組,並可一次復原。Esc 結束多選模式。編輯概要文字時,Enter 儲存,Esc 取消。選取概要後,Delete 或 Backspace 刪除概要。"
}
]
},
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.sy
index 719bdb106d..cf45a1ab23 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": "20261020162345"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -13053,7 +13053,7 @@
"Type": "NodeHeading",
"Properties": {
"id": "20260921105011-icqlkb6",
- "updated": "20261020162345"
+ "updated": "20261022132341"
},
"HeadingLevel": 3,
"Children": [
@@ -13067,12 +13067,13 @@
"ID": "20261018163000-3gwfc4c",
"Type": "NodeParagraph",
"Properties": {
- "id": "20261018163000-3gwfc4c"
+ "id": "20261018163000-3gwfc4c",
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "キャンバス上で Esc を押すと閲覧に戻り、ホイールで文書をスクロールできます。ノード編集中、要約範囲の選択中、関連線のドラッグ中は、まず現在の操作を終了またはキャンセルします。全画面表示では Esc で全画面表示を終了します。"
+ "Data": "キャンバス上で Esc を押すと閲覧に戻り、ホイールで文書をスクロールできます。ノード編集中や関連線のドラッグ中は、まず現在の操作を終了またはキャンセルします。複数選択モードも終了します。全画面表示では Esc で全画面表示を終了します。"
}
]
},
@@ -13879,12 +13880,21 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926152753-5vwcnw1",
- "updated": "20260926152753"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "要約の一括作成プレビューでは Enter で全グループを作成し、Esc でキャンセルします。作成は一度の取り消しで元に戻せます。要約範囲の選択中は上下の矢印キーで同じ親を持つ末端のノードを選び、Enter で確定、Esc でキャンセルします。要約テキストの編集中は Enter で保存、Esc でキャンセルします。選択中の要約は Delete または Backspace で削除できます。"
+ "Data": "ノードを選択してから、下部のノードメニューで "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "要約"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " を実行すると、有効な全グループを一度に作成し、一度の取り消しで元に戻せます。Esc で複数選択モードを終了します。要約テキストの編集中は Enter で保存、Esc でキャンセルします。選択中の要約は Delete または Backspace で削除できます。"
}
]
},
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.sy
index a3e86bd920..d1116b79b8 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": "20261022122318"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -2090,7 +2090,7 @@
"Properties": {
"ID": "20240530101000-ch5e4vh",
"id": "20240530101000-1ev7xub",
- "updated": "20261021132218"
+ "updated": "20261022132341"
},
"Children": [
{
@@ -2405,12 +2405,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261022102848-vdgjx9w",
- "updated": "20261022102848"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "複数のノードを選択すると、下部のパレットで文字色と背景色をまとめて変更できます。枝線のパレットでは、選択したノードに入る階層の接続線の色を変更できます。一括変更は一度の取り消しで元に戻せます。パレットでデフォルトを選ぶと、テーマまたは既定の色に戻ります。タッチ画面では、下部のノードメニューにある複数選択ボタンでノードを選択できます。"
+ "Data": "複数のノードを選択すると、下部のパレットで文字色と背景色をまとめて変更できます。枝線のパレットでは、選択したノードに入る階層の接続線の色を変更できます。一括変更は一度の取り消しで元に戻せます。パレットでデフォルトを選ぶと、テーマまたは既定の色に戻ります。タッチ画面では、上部ツールバーの複数選択ボタンでノードを選択できます。"
}
]
},
@@ -3778,12 +3778,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260926151827-vknoaqd",
- "updated": "20261020162345"
+ "updated": "20261022132341"
},
"Children": [
{
"Type": "NodeText",
- "Data": "範囲の最初のノードを選択し、下部のノードメニューで "
+ "Data": "ノードを選択してから、下部のノードメニューで "
},
{
"Type": "NodeTextMark",
@@ -3792,7 +3792,16 @@
},
{
"Type": "NodeText",
- "Data": " をクリックしてから、同じ親を持つ末端のノードを選択すると、角括弧と要約テキストを追加できます。範囲は連続している必要があります。単一ノードの要約と範囲の入れ子に対応し、包含関係は許可されますが、交差する範囲は作成できません。括弧は表示中の子ツリーと内側の要約を囲みます。一括作成するには要約ボタンを押してキャンバスの空白部分をドラッグします。空白部分をタップしてからノードを個別に選択することもできます。プレビューでは同じ親を持つ連続したノードをグループ化し、親子が同時に選択された場合は最も外側のノードを優先します。同じ要約は重複して作成せず、交差する範囲がある場合は作成を止めます。確認ボタンまたは Enter で全グループを一度に作成し、一度の取り消しで元に戻せます。Esc でキャンセルします。文書が更新されると保留中の選択はキャンセルされます。モバイルでも同じ手順で操作できます。範囲の選択中は上下の矢印キーで末端のノードを選び、Enter で範囲を確定し、Esc でキャンセルすることもできます。"
+ "Data": " をクリックすると、再選択や確認なしですぐに作成できます。デスクトップでは空白部分をドラッグするか、Ctrl/Command を押しながらノードをクリックします。タッチ画面では上部ツールバーの "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "複数選択"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " を有効にしてからノードをタップします。同じ親を持つ連続した選択ノードは 1 つの要約になり、離れた範囲や異なる親の範囲は別々の要約になります。未選択のノードは含めません。親子を同時に選択した場合は最も外側のノードを優先します。単一ノードと入れ子の要約に対応し、同じ要約は重複して作成しません。範囲が交差する場合は作成を無効にし、メッセージを表示します。括弧は表示中の子ツリーと内側の要約を囲みます。全グループを一度に作成し、一度の取り消しで元に戻せます。使用できないノード操作は無効になります。Esc で複数選択モードを終了します。"
}
]
},
diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scss
index da3aea40c6..b62be6cf6a 100644
--- a/app/src/assets/scss/protyle/_mindmap-view.scss
+++ b/app/src/assets/scss/protyle/_mindmap-view.scss
@@ -247,10 +247,6 @@
pointer-events: none;
}
- &__viewport--summary {
- cursor: crosshair;
- }
-
&__selection-box {
position: absolute;
pointer-events: none;
@@ -260,26 +256,6 @@
z-index: 5;
}
- &__summary-controls {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 8px;
-
- > span {
- flex: 1 1 auto;
- min-width: 0;
- overflow-wrap: anywhere;
- }
- }
-
- &__summary-actions {
- display: flex;
- flex-shrink: 0;
- gap: 8px;
- margin-left: auto;
- }
-
&__viewport--pan {
cursor: grab;
diff --git a/app/src/protyle/render/listMindmap/anchorsView.test.ts b/app/src/protyle/render/listMindmap/anchorsView.test.ts
index 9120c20756..e1f1c1e1d1 100644
--- a/app/src/protyle/render/listMindmap/anchorsView.test.ts
+++ b/app/src/protyle/render/listMindmap/anchorsView.test.ts
@@ -41,7 +41,7 @@ const setup = (overrides: Partial<ListMindmapRelation> = {}) => {
routingObstacles: () => [...positions.values()], draw: () => {}, refreshLayout: () => {},
clearDrop: () => {}, setHoveredLine: () => {}, finishThen: (action: () => void) => action(),
routeHandles: new Map(), routeStatus: {}, label: (key: string) => key,
- summaryBox: {hidden: true},
+ selectionBox: {hidden: true},
getRouteHandle: () => ({style: {}}),
});
view.relationRoutes.set("r", view.calculateRelationRoute(relation, positions.get("a"), positions.get("b")));
diff --git a/app/src/protyle/render/listMindmap/arrows.test.ts b/app/src/protyle/render/listMindmap/arrows.test.ts
index cc743c5ce0..af9efa0bdd 100644
--- a/app/src/protyle/render/listMindmap/arrows.test.ts
+++ b/app/src/protyle/render/listMindmap/arrows.test.ts
@@ -70,6 +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},
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/index.ts b/app/src/protyle/render/listMindmap/index.ts
index bd63ef203a..f3f224ec43 100644
--- a/app/src/protyle/render/listMindmap/index.ts
+++ b/app/src/protyle/render/listMindmap/index.ts
@@ -46,7 +46,7 @@ import {focusListMindmap} from "./create";
import {getListMindmapFoldStates, getListMindmapSiblingFoldStates} from "./fold";
import {getListMindmapFoldMenuItems} from "./foldMenu";
import {isMobile} from "../../../util/functions";
-import {addListMindmapSummaryRanges, getListMindmapSiblingIDs, getListMindmapSummaryParentID, getListMindmapSummaryRange,
+import {addListMindmapSummaryRanges, getListMindmapSiblingIDs,
getListMindmapSummarySnapshot} from "./summary";
import {getProtyleTransactionOwner, isProtyleListItemFragment} from "../../runtimeCapabilities";
import {isFoldedRenderContent} from "../foldedContent";
@@ -517,23 +517,6 @@ class ListMindmapController {
onRelationDelete: id => this.metadata(metadata => {
metadata.relations = metadata.relations.filter(item => item.id !== id);
}),
- onSummaryAdd: async (from, to) => {
- let ids: string[];
- const saved = await this.change(() => {
- const model = readListMindmap(list);
- const nodeIds = getListMindmapSummaryRange(model, from, to);
- if (!nodeIds.length) {
- return false;
- }
- ids = addListMindmapSummaryRanges(model, [{parentId: getListMindmapSummaryParentID(model, from), nodeIds}],
- () => Lute.NewNodeID(), window.siyuan.languages.listMindmapSummary);
- if (!ids) {
- return false;
- }
- writeListMindmapMetadata(list, model.metadata);
- });
- return saved ? ids?.[0] : undefined;
- },
onSummaryBatchAdd: async (ranges, expected) => {
let ids: string[];
const saved = await this.change(() => {
diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.ts
index a9605192bd..6c02df4ab5 100644
--- a/app/src/protyle/render/listMindmap/model.test.ts
+++ b/app/src/protyle/render/listMindmap/model.test.ts
@@ -2103,7 +2103,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
`More stays rightmost after wrapping, width=${width}, fontSize=${fontSize}`);
}
}
- check.equal(lastButton.top > firstButton.top, width < 180,
+ check.equal(lastButton.top > firstButton.top, width < 220,
`compact global toolbars wrap only when necessary, width=${width}, fontSize=${fontSize}`);
check.equal(getComputedStyle(toolbarPopup).display, "flex", "zoom popup remains visible");
if (width >= 240) {
@@ -3074,7 +3074,8 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
});
await settle();
const levelButton = host.querySelector<HTMLButtonElement>('.mindmap-view__toolbar button[aria-label="expandLevel"]');
- check.equal(levelButton.previousElementSibling.getAttribute("aria-label"), "listMindmapLock");
+ check.equal(levelButton.previousElementSibling.getAttribute("aria-label"), "multiSelect");
+ check.equal(levelButton.previousElementSibling.previousElementSibling.getAttribute("aria-label"), "listMindmapLock");
check.equal(levelButton.nextElementSibling.getAttribute("aria-label"), "cursorHand");
check.equal(host.querySelector(".mindmap-view__level-select"), null);
levelView.selectNode(levelChild);
@@ -3923,7 +3924,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
doubleClickImage();
check.equal(previewed.length, 3, "locked nodes support image previews without editing");
richView.setLocked(false);
- for (const mode of ["relationFrom", "summarySelecting", "panning", "pinching"]) {
+ for (const mode of ["relationFrom", "panning", "pinching"]) {
richView[mode] = true;
doubleClickImage();
check.equal(previewed.length, 3, "active canvas interactions do not open image previews");
@@ -4621,14 +4622,14 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
let summaryView: any;
summaryView = new api.ListMindmapView({host: summaryHost, model: summaryModel, onExit: () => {},
labels: new Proxy({}, {get: (_target, key) => String(key)}),
- onSummaryAdd: async (from: string, to: string) => {
+ onSummaryBatchAdd: async (ranges: any[], expected: string) => {
const model = api.readListMindmap(summaryList);
- const nodeIds = api.getListMindmapSummaryRange(model, from, to);
- check.equal(nodeIds.length, 3);
- model.metadata.summaries = [{id: "summary", parentId: model.root.id, nodeIds, label: "Summary"}];
+ check.equal(api.getListMindmapSummarySnapshot(model), expected);
+ const added = api.addListMindmapSummaryRanges(model, ranges, () => "summary", "Summary");
+ check.deepEqual(added, ["summary"]);
api.writeListMindmapMetadata(summaryList, model.metadata);
summaryView.update(api.readListMindmap(summaryList));
- return "summary";
+ return added;
},
onSummaryChange: (id: string, patch: object, expected: string) => {
const model = api.readListMindmap(summaryList);
@@ -4642,11 +4643,10 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
summaryView.focusNode(summaryIds[0]);
const summaryButton = summaryHost.querySelector<HTMLButtonElement>('[aria-label="listMindmapSummary"]');
check.equal(summaryButton.disabled, false);
+ for (const id of summaryIds.slice(1)) {
+ summaryView.selectNode(id, true);
+ }
summaryButton.click();
- check.equal(summaryButton.getAttribute("aria-pressed"), "true");
- summaryHost.querySelector(`[data-mindmap-id="${summaryIds[2]}"]`).dispatchEvent(new PointerEvent("pointerdown",
- {bubbles: true, pointerId: 71, pointerType: "touch", isPrimary: true, button: 0}));
- await settle();
await settle();
const summaryInput = summaryHost.querySelector<HTMLInputElement>(".mindmap-view__summary-editor");
check.ok(summaryInput, "new summaries enter text editing on touch selection");
@@ -4804,19 +4804,35 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
const copiedSummary = api.readListMindmap(copied).metadata.summaries[0];
check.equal(copiedSummary.parentId, copiedIDs.get(savedSummary.parentId));
check.deepEqual(copiedSummary.nodeIds, savedSummary.nodeIds.map((id: string) => copiedIDs.get(id)));
+ const crossingModel = api.readListMindmap(summaryList);
+ crossingModel.metadata.summaries = [{...savedSummary, nodeIds: summaryIds.slice(0, 2)}];
+ api.writeListMindmapMetadata(summaryList, crossingModel.metadata);
+ summaryView.update(api.readListMindmap(summaryList));
+ summaryView.focusNode(summaryIds[1]);
+ summaryView.selectNode(summaryIds[2], true);
+ 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");
+ summaryButton.click();
+ check.deepEqual(api.readListMindmap(summaryList).metadata.summaries[0].nodeIds, summaryIds.slice(0, 2));
+ summaryView.clearSelection();
+ check.equal(summaryView.summaryStatus.hidden, true);
const keyboardModel = api.readListMindmap(summaryList);
keyboardModel.metadata.summaries = [];
api.writeListMindmapMetadata(summaryList, keyboardModel.metadata);
summaryView.update(api.readListMindmap(summaryList));
summaryView.focusNode(summaryIds[0]);
- summaryButton.click();
- for (const key of ["ArrowDown", "ArrowDown", "Enter"]) {
- summaryHost.dispatchEvent(new KeyboardEvent("keydown", {key, bubbles: true}));
+ for (const id of summaryIds.slice(1)) {
+ summaryView.selectNode(id, true);
}
- await settle();
+ summaryButton.focus();
+ const summaryKey = new KeyboardEvent("keydown", {key: "Enter", bubbles: true, cancelable: true});
+ summaryButton.dispatchEvent(summaryKey);
+ check.equal(summaryKey.defaultPrevented, false, "summary buttons retain native keyboard activation");
+ summaryButton.click();
await settle();
const keyboardInput = summaryHost.querySelector<HTMLInputElement>(".mindmap-view__summary-editor");
- check.ok(keyboardInput, "keyboard range selection creates an editable summary");
+ check.ok(keyboardInput, "keyboard activation creates an editable summary from selected nodes");
keyboardInput.value = savedSummary.label;
keyboardInput.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter", bubbles: true}));
await settle();
@@ -4941,61 +4957,46 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
return added;
}});
await settle();
- batchView.focusNode(api.readListMindmap(batchList).root.id);
- const batchButton = batchHost.querySelector<HTMLButtonElement>('.mindmap-view__inspector [aria-label="listMindmapSummary"]');
const batchViewport = batchHost.querySelector<HTMLElement>(".mindmap-view__viewport");
- check.equal(batchButton.disabled, false, "the root node menu starts batch selection without choosing a parent range");
- batchButton.click();
+ const multiSelect = batchHost.querySelector<HTMLButtonElement>('.mindmap-view__toolbar [aria-label="multiSelect"]');
+ check.ok(multiSelect, "multi-select is available before choosing a node");
+ multiSelect.click();
+ check.equal(multiSelect.getAttribute("aria-pressed"), "true");
const batchModel = api.readListMindmap(batchList);
const leafIDs = batchModel.root.children.flatMap((node: ListMindmapNode) => node.children.map(child => child.id));
- const leafRects = leafIDs.map((id: string) => batchHost.querySelector(`[data-mindmap-id="${id}"]`).getBoundingClientRect());
- const left = Math.min(...leafRects.map((rect: DOMRect) => rect.left)) - 1;
- const top = Math.min(...leafRects.map((rect: DOMRect) => rect.top)) - 1;
- const right = Math.max(...leafRects.map((rect: DOMRect) => rect.right)) + 1;
- const bottom = Math.max(...leafRects.map((rect: DOMRect) => rect.bottom)) + 1;
- sendPointer(batchViewport, "pointerdown", left, top);
- sendPointer(batchViewport, "pointermove", right, bottom);
- sendPointer(batchViewport, "pointerup", right, bottom);
- check.equal(batchView.summaryRanges.length, 2);
- check.equal(batchHistory.length, 0, "dragging only previews the groups");
- check.equal(batchHost.querySelector<HTMLElement>(".mindmap-view__summary-controls").hidden, false);
- const controls = batchHost.querySelector<HTMLElement>(".mindmap-view__summary-controls");
- const actions = [...controls.querySelectorAll("button")];
- const checkButtonRow = () => {
- check.equal(actions[0].getBoundingClientRect().top, actions[1].getBoundingClientRect().top,
- "cancel and confirm stay on one row");
- };
- checkButtonRow();
- const countBounds = controls.querySelector("span").getBoundingClientRect();
- const actionBounds = actions[0].getBoundingClientRect();
- check.ok(Math.abs(countBounds.top + countBounds.height / 2 - actionBounds.top - actionBounds.height / 2) < 1,
- "compact localized labels do not force actions onto a separate row");
- check.equal(actions[0].textContent, batchLabels.cancel);
- check.equal(actions[1].textContent, batchLabels.confirm);
- actions[0].focus();
- const cancelKey = new KeyboardEvent("keydown", {key: "Enter", bubbles: true, cancelable: true});
- actions[0].dispatchEvent(cancelKey);
- check.equal(cancelKey.defaultPrevented, false, "focused cancel keeps native keyboard activation");
- check.equal(batchHistory.length, 0, "Enter on cancel never confirms the batch");
- batchHost.style.width = "280px";
- batchHost.style.fontSize = "32px";
- await settle();
- const controlsBounds = controls.getBoundingClientRect();
- checkButtonRow();
- check.ok(controlsBounds.width <= batchHost.offsetWidth - 16);
- controls.querySelectorAll("button").forEach(button => {
- const rect = button.getBoundingClientRect();
- check.ok(rect.left >= controlsBounds.left && rect.right <= controlsBounds.right);
- check.ok(rect.top >= controlsBounds.top && rect.bottom <= controlsBounds.bottom);
- check.ok(button.classList.contains("b3-button"));
- });
- batchHost.style.width = "700px";
+ for (const id of leafIDs) {
+ batchHost.querySelector(`[data-mindmap-id="${id}"]`).dispatchEvent(new PointerEvent("pointerdown", {
+ bubbles: true, pointerId: 81, pointerType: "touch", isPrimary: true, button: 0,
+ }));
+ }
+ check.equal(batchView.getSelectedIds().length, 4, "touch multi-select uses the ordinary selection");
+ check.equal(batchView.pointer, undefined, "multi-select taps cannot arm node dragging");
+ check.equal(batchHistory.length, 0);
+ 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"]');
+ 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);
+ for (const width of [240, 320, 700]) {
+ batchHost.style.width = `${width}px`;
+ batchHost.style.fontSize = "32px";
+ await settle();
+ const bounds = batchInspector.getBoundingClientRect();
+ check.ok(bounds.width <= batchHost.offsetWidth - 16);
+ for (const control of [batchButton, multiSelect]) {
+ const rect = control.getBoundingClientRect();
+ const hostBounds = batchHost.getBoundingClientRect();
+ check.ok(rect.left >= hostBounds.left && rect.right <= hostBounds.right);
+ }
+ }
batchHost.style.fontSize = "";
+ batchButton.click();
await settle();
- batchHost.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter", bubbles: true}));
- await settle();
- check.equal(batchHistory.length, 1, "all groups use a single submission");
+ check.equal(batchHistory.length, 1, "clicking summary submits all groups once without a confirmation step");
check.equal(api.readListMindmap(batchList).metadata.summaries.length, 2);
+ check.equal(batchButton.disabled, true, "identical groups cannot be created twice");
const restoreBatch = (html: string) => {
const restored = document.createElement("div");
restored.innerHTML = html;
@@ -5003,25 +5004,26 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,
};
check.equal(api.readListMindmap(restoreBatch(batchHistory[0].before)).metadata.summaries, undefined);
check.equal(api.readListMindmap(restoreBatch(batchHistory[0].after)).metadata.summaries.length, 2);
- batchButton.click();
- const batchBlank = batchViewport.getBoundingClientRect();
- sendPointer(batchViewport, "pointerdown", batchBlank.left + 1, batchBlank.top + 1);
- sendPointer(batchViewport, "pointerup", batchBlank.left + 1, batchBlank.top + 1);
- for (const id of leafIDs.slice(0, 2)) {
- batchHost.querySelector(`[data-mindmap-id="${id}"]`).dispatchEvent(new PointerEvent("pointerdown", {
- bubbles: true, pointerId: 81, pointerType: "touch", isPrimary: true, button: 0,
- }));
- }
- check.equal(batchView.summarySelected.size, 2, "touch taps build a batch selection");
- check.equal(batchView.summaryRanges.length, 0, "existing groups are not duplicated");
- batchView.update(api.readListMindmap(batchList));
- check.equal(batchView.summarySelecting, false, "external updates invalidate pending selections");
- batchButton.click();
+ multiSelect.click();
+ batchView.clearSelection();
+ const leafRects = leafIDs.map((id: string) => batchHost.querySelector(`[data-mindmap-id="${id}"]`).getBoundingClientRect());
+ const left = Math.min(...leafRects.map((rect: DOMRect) => rect.left)) - 1;
+ const top = Math.min(...leafRects.map((rect: DOMRect) => rect.top)) - 1;
+ const right = Math.max(...leafRects.map((rect: DOMRect) => rect.right)) + 1;
+ const bottom = Math.max(...leafRects.map((rect: DOMRect) => rect.bottom)) + 1;
sendPointer(batchViewport, "pointerdown", left, top);
sendPointer(batchViewport, "pointermove", right, bottom);
+ sendPointer(batchViewport, "pointerup", right, bottom);
+ check.equal(batchView.getSelectedIds().length, 4);
+ check.equal(batchInspector.hidden, false, "ordinary marquee selection opens the node menu");
+ check.equal(batchButton.disabled, true, "existing groups are not duplicated after marquee selection");
+ batchView.update(api.readListMindmap(batchList));
+ check.equal(batchButton.disabled, true, "external updates recalculate action availability");
+ multiSelect.click();
batchHost.dispatchEvent(new KeyboardEvent("keydown", {key: "Escape", bubbles: true}));
- check.equal(batchView.summarySelecting, false);
- check.equal(batchHistory.length, 1, "canceling never submits a second batch");
+ check.equal(batchView.multiSelect, false);
+ check.equal(multiSelect.getAttribute("aria-pressed"), "false");
+ check.equal(batchHistory.length, 1, "leaving selection mode does not create another batch");
batchView.destroy();
batchHost.remove();
style.remove();
diff --git a/app/src/protyle/render/listMindmap/paste.test.ts b/app/src/protyle/render/listMindmap/paste.test.ts
index 1e6977668f..3f57d100f0 100644
--- a/app/src/protyle/render/listMindmap/paste.test.ts
+++ b/app/src/protyle/render/listMindmap/paste.test.ts
@@ -48,15 +48,13 @@ test("selected mind map nodes paste all clipboard files into a new child after f
});
test("mind map paste respects edit state, selection and read-only boundaries", () => {
- for (const mode of ["readonly", "editing", "relation", "summary", "batch", "multiple", "missing", "unselected",
+ for (const mode of ["readonly", "editing", "relation", "multiple", "missing", "unselected",
"input", "editable", "handled", "text", "export"]) {
const current = create();
switch (mode) {
case "readonly": current.target.readOnly = true; break;
case "editing": current.target.editingId = "node"; break;
case "relation": current.target.relationFrom = "node"; break;
- case "summary": current.target.summaryFrom = "node"; current.target.summarySelecting = true; break;
- case "batch": current.target.summarySelecting = true; break;
case "multiple": current.target.getSelectedIds = () => ["node", "other"]; break;
case "missing": current.target.model.nodes.clear(); break;
case "unselected": current.target.selectedId = undefined; break;
diff --git a/app/src/protyle/render/listMindmap/preview.test.ts b/app/src/protyle/render/listMindmap/preview.test.ts
index 3813e4f51c..15690f5c93 100644
--- a/app/src/protyle/render/listMindmap/preview.test.ts
+++ b/app/src/protyle/render/listMindmap/preview.test.ts
@@ -185,7 +185,7 @@ const cases = async (source: string, css: string) => {
const view = Object.assign(new api.MindmapPreviewView(), {
options: {}, viewport: document.createElement("div"), persistedLocked: false,
nodeElements: new Map([[node.id, nodeElement]]), folded: new Map(), selectedIds: new Set(),
- cancelSummarySelection: () => {}, renderTask: () => {}, destroyContentViews: () => {},
+ renderTask: () => {}, destroyContentViews: () => {},
label: (key: string) => key, updateRelations: () => {}, updateSummaries: () => {},
updateSelection: () => {}, renderInspector: () => {}, refreshLayout: () => {},
});
diff --git a/app/src/protyle/render/listMindmap/summary.test.ts b/app/src/protyle/render/listMindmap/summary.test.ts
index 577cfd142c..c12823c9cb 100644
--- a/app/src/protyle/render/listMindmap/summary.test.ts
+++ b/app/src/protyle/render/listMindmap/summary.test.ts
@@ -134,6 +134,15 @@ test("batch selection partitions contiguous siblings, omits descendants and dete
assert.deepEqual(getListMindmapSummarySelection(model, new Set(["a", "b"])).ranges, []);
});
+test("virtual centers do not suppress selected real nodes or create their own summaries", () => {
+ const model = makeModel();
+ model.root.virtual = true;
+ assert.deepEqual(getListMindmapSummarySelection(model, new Set(["root", "a", "b", "nested", "missing"])), {
+ ranges: [{parentId: "root", nodeIds: ["a", "b"]}], conflict: false,
+ });
+ assert.deepEqual(getListMindmapSummarySelection(model, new Set(["root"])), {ranges: [], conflict: false});
+});
+
test("batch creation is atomic and upgrades only configurations that require nesting", () => {
const model = makeModel();
let next = 0;
diff --git a/app/src/protyle/render/listMindmap/summary.ts b/app/src/protyle/render/listMindmap/summary.ts
index 8dfbb3da09..198b5789fb 100644
--- a/app/src/protyle/render/listMindmap/summary.ts
+++ b/app/src/protyle/render/listMindmap/summary.ts
@@ -120,6 +120,7 @@ export const getListMindmapSummaryRange = (model: ListMindmapModel, from: string
// 框选只保留最外层的选中节点,并按父节点及连续范围分组。
export const getListMindmapSummarySelection = (model: ListMindmapModel, selected: Set<string>) => {
+ selected = new Set([...selected].filter(id => model.nodes.has(id) && !model.nodes.get(id).virtual));
const groups: ListMindmapSummaryRange[] = [];
getListMindmapSiblingIDs(model).forEach((ids, parentId) => {
let group: string[] = [];
diff --git a/app/src/protyle/render/listMindmap/summaryView.test.ts b/app/src/protyle/render/listMindmap/summaryView.test.ts
index fdffb2c666..655feeea78 100644
--- a/app/src/protyle/render/listMindmap/summaryView.test.ts
+++ b/app/src/protyle/render/listMindmap/summaryView.test.ts
@@ -4,7 +4,7 @@ import test from "node:test";
import {runInNewContext} from "node:vm";
import {createSourceFile, isClassDeclaration, ScriptTarget, transpileModule} from "typescript";
import {buildListMindmapSummaryConnector, LIST_MINDMAP_CONNECTOR_STYLES} from "./connectors";
-import {layoutListMindmapSummaries} from "./summary";
+import {addListMindmapSummaryRanges, getListMindmapSummarySelection, getListMindmapSummarySnapshot, layoutListMindmapSummaries} from "./summary";
import type {ListMindmapModel, ListMindmapNode} from "./model";
const source = createSourceFile("view.ts", readFileSync("src/protyle/render/listMindmap/view.ts", "utf8"),
@@ -27,7 +27,7 @@ class PathFixture {
test("summary previews and committed paths match across styles, zoom levels and the legacy default", () => {
for (const connectorStyle of [undefined, ...LIST_MINDMAP_CONNECTOR_STYLES]) {
for (const scale of [.5, 1, 2]) {
- const sandbox: any = {Path2D: PathFixture, buildListMindmapSummaryConnector, layoutListMindmapSummaries};
+ const sandbox: any = {Path2D: PathFixture, buildListMindmapSummaryConnector, layoutListMindmapSummaries, getListMindmapSummarySelection};
runInNewContext(compiled, sandbox);
const view = new sandbox.View();
const child: ListMindmapNode = {id: "a", parentId: "root", children: [], contentBlocks: [], virtual: false, collapsed: false};
@@ -36,8 +36,7 @@ test("summary previews and committed paths match across styles, zoom levels and
const 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(), summaryRanges: [range],
- summarySelecting: true, options: {}, scale, linePaths: [], summaryElements: new Map()});
+ Object.assign(view, {model, positions, summaryPositions: new Map(), getSelectedIds: () => ["a"], inspector: {hidden: false}, options: {}, scale, linePaths: [], summaryElements: new Map()});
const strokes: PathFixture[] = [];
const context = {save: () => {}, restore: () => {}, setLineDash: () => {},
stroke: (path: PathFixture) => strokes.push(path)};
@@ -61,3 +60,83 @@ test("summary previews and committed paths match across styles, zoom levels and
}
}
});
+
+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;`,
+ {compilerOptions: {target: ScriptTarget.ES2021}}).outputText;
+const create = () => {
+ const frames: (() => void)[] = [];
+ const context: any = {getListMindmapSummarySelection, getListMindmapSummarySnapshot,
+ requestAnimationFrame: (action: () => void) => frames.push(action), console: {error: () => {}}};
+ runInNewContext(creationCode, context);
+ const children = ["a", "b", "c"].map((id): ListMindmapNode => ({id, parentId: "root", children: [], virtual: false, collapsed: false, contentBlocks: []}));
+ const root: ListMindmapNode = {id: "root", children, virtual: true, collapsed: false, contentBlocks: []};
+ const model: ListMindmapModel = {list: undefined, root, nodes: new Map([root, ...children].map(node => [node.id, node])),
+ metadata: {version: 1, nodes: {}, relations: []}};
+ let selected = ["a", "b"];
+ const calls: {ranges: {parentId: string, nodeIds: string[]}[], expected: string}[] = [];
+ const edited: string[] = [];
+ const view = Object.assign(new context.View(), {model, getSelectedIds: () => selected,
+ options: {onSummaryBatchAdd: async (ranges: {parentId: string, nodeIds: string[]}[], expected: string) => {
+ calls.push({ranges, expected});
+ return addListMindmapSummaryRanges(model, ranges, () => "new", "Summary");
+ }}, updateSelection: () => {}, selectSummary: (id: string) => { view.selectedSummary = id; },
+ editSummaryLabel: (id: string) => edited.push(id)});
+ return {view, model, calls, frames, edited, select: (ids: string[]) => selected = ids};
+};
+
+test("summary creation consumes the current selection once and retains the snapshot and editable result", async () => {
+ const {view, model, calls, frames, edited} = create();
+ const expected = getListMindmapSummarySnapshot(model);
+ await view.createSummary();
+ assert.deepEqual(calls, [{ranges: [{parentId: "root", nodeIds: ["a", "b"]}], expected}]);
+ assert.equal(view.summaryPending, false);
+ assert.equal(model.metadata.summaries.length, 1);
+ frames.forEach(action => action());
+ assert.deepEqual(edited, ["new"]);
+ await view.createSummary();
+ assert.equal(calls.length, 1, "identical ranges do not submit again");
+});
+
+test("invalid, crossing, duplicate and read-only summary selections never submit", async () => {
+ for (const mode of ["empty", "virtual", "crossing", "duplicate", "readonly", "locked", "export"]) {
+ const {view, model, calls, select} = create();
+ if (mode === "empty") { select([]); }
+ if (mode === "virtual") { select(["root"]); }
+ if (mode === "crossing" || mode === "duplicate") {
+ addListMindmapSummaryRanges(model, [{parentId: "root", nodeIds: ["a", "b"]}], () => "old", "Old");
+ if (mode === "crossing") { select(["b", "c"]); }
+ }
+ if (mode === "readonly" || mode === "locked") { view.readOnly = true; }
+ if (mode === "export") { view.options.onSummaryBatchAdd = undefined; }
+ await view.createSummary();
+ assert.equal(calls.length, 0, mode);
+ }
+});
+
+test("pending summaries reject repeated activation and late results preserve a changed selection", async () => {
+ for (const outcome of ["success", "selection", "readonly", "destroyed", "failed", "rejected"]) {
+ const {view, select, frames, edited} = create();
+ let resolve: (ids?: string[]) => void;
+ let reject: (error: Error) => void;
+ let submitted = 0;
+ view.options.onSummaryBatchAdd = () => {
+ submitted++;
+ return new Promise<string[] | undefined>((done, fail) => { resolve = done; reject = fail; });
+ };
+ const pending = view.createSummary();
+ assert.equal(view.summaryPending, true);
+ await view.createSummary();
+ assert.equal(submitted, 1);
+ if (outcome === "selection") { select(["c"]); }
+ if (outcome === "readonly") { view.readOnly = true; }
+ if (outcome === "destroyed") { view.destroyed = true; }
+ if (outcome === "rejected") { reject(new Error("write failed")); }
+ else { resolve(outcome === "failed" ? undefined : ["new"]); }
+ await pending;
+ frames.forEach(action => action());
+ assert.equal(view.summaryPending, false);
+ assert.deepEqual(edited, outcome === "success" ? ["new"] : [], outcome);
+ }
+});
diff --git a/app/src/protyle/render/listMindmap/touchDrag.test.ts b/app/src/protyle/render/listMindmap/touchDrag.test.ts
index 2c404f149b..465e1909eb 100644
--- a/app/src/protyle/render/listMindmap/touchDrag.test.ts
+++ b/app/src/protyle/render/listMindmap/touchDrag.test.ts
@@ -29,7 +29,7 @@ const setup = () => {
remove: (...names: string[]) => names.forEach(name => classes.delete(name))}};
const target = Object.assign(new context.View(), {
options: {}, model: {nodes: new Map([["child", {}]])},
- nodeElements: new Map([["child", element]]), inspector: {}, summaryBox: {},
+ nodeElements: new Map([["child", element]]), inspector: {}, selectionBox: {},
viewport: {classList: element.classList},
selectNode: (id: string) => selected.push(id), clearDrop: () => {},
setHoveredLine: () => {}, requestDraw: () => {},
@@ -100,7 +100,7 @@ test("cancellation and pointer replacement cannot leave a delayed node drag", ()
});
test("read-only, locked, gesture and selection modes, destroyed and removed-node states reject a pending hold", () => {
- for (const mode of ["readOnly", "locked", "pinching", "panning", "multiSelect", "summarySelecting", "relationFrom", "destroyed", "removed"]) {
+ for (const mode of ["readOnly", "locked", "pinching", "panning", "multiSelect", "relationFrom", "destroyed", "removed"]) {
const {target, pointer, selected, flush} = setup();
if (mode === "readOnly") {
target.options.readOnly = true;
diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.ts
index 5358991197..def2a518c5 100644
--- a/app/src/protyle/render/listMindmap/view.ts
+++ b/app/src/protyle/render/listMindmap/view.ts
@@ -18,7 +18,7 @@ import {destroyTabsRender, tabsRender} from "../tabsRender";
import {getListMindmapFoldStates, getListMindmapSiblingFoldStates} from "./fold";
import type {ListMindmapFoldTarget} from "./fold";
import {clampMindmapPanOffset, clampMindmapPanPosition, MindmapPanRect} from "./pan";
-import {getListMindmapSummaryParentID, getListMindmapSummaryRange, getListMindmapSummarySelection, getListMindmapSummarySnapshot,
+import {getListMindmapSummarySelection, getListMindmapSummarySnapshot,
layoutListMindmapSummaries} from "./summary";
import type {ListMindmapSummary, ListMindmapSummaryPosition, ListMindmapSummaryRange} from "./summary";
import {buildListMindmapConnectors, buildListMindmapSummaryConnector} from "./connectors";
@@ -74,7 +74,6 @@ export interface ListMindmapViewOptions {
onRelationAdd?: (from: string, to: string) => void;
onRelationChange?: (id: string, patch: Partial<ListMindmapRelation>, expected?: string) => void;
onRelationDelete?: (id: string) => void;
- onSummaryAdd?: (from: string, to: string) => Promise<string | undefined>;
onSummaryBatchAdd?: (ranges: ListMindmapSummaryRange[], expected: string) => Promise<string[] | undefined>;
onSummaryChange?: (id: string, patch: Pick<Partial<ListMindmapSummary>, "label" | "color">, expected?: string) => void;
onSummaryDelete?: (id: string) => void;
@@ -95,7 +94,6 @@ interface PointerState {
y: number;
moved: boolean;
hiddenControls?: HTMLElement[];
- summary?: boolean;
selection?: string[];
targetId?: string;
placement?: "before" | "child" | "after";
@@ -141,15 +139,8 @@ export class ListMindmapView {
private summaryPositions = new Map<string, ListMindmapSummaryPosition>();
private readonly summaryStatus = createElement("div", "mindmap-view__route-status");
private selectedSummary?: string;
- private summaryFrom?: string;
- private summarySelecting = false;
- private summarySnapshot?: string;
- private summarySelected = new Set<string>();
- private summaryRanges: ListMindmapSummaryRange[] = [];
- private readonly summaryControls = createElement("div", "mindmap-view__inspector mindmap-view__summary-controls");
- private readonly summaryCount = createElement("span", "");
- private readonly summaryConfirm = createElement("button", "b3-button b3-button--text");
- private readonly summaryBox = createElement("div", "mindmap-view__selection-box");
+ private summaryPending = false;
+ private readonly selectionBox = createElement("div", "mindmap-view__selection-box");
private finishSummaryEdit?: (save: boolean) => void;
private editingSummary?: string;
private readonly buttons = new Map<string, HTMLButtonElement>();
@@ -239,26 +230,10 @@ export class ListMindmapView {
options.host.append(this.toolbar, this.viewport, this.inspector, this.tooltip, this.colorProbe, this.routeStatus);
this.summaryStatus.hidden = true;
this.summaryStatus.setAttribute("role", "status");
- this.summaryStatus.textContent = this.label("listMindmapSummarySelect");
+ this.summaryStatus.textContent = this.label("listMindmapSummaryConflict");
options.host.append(this.summaryStatus);
- this.summaryControls.hidden = true;
- this.summaryCount.setAttribute("role", "status");
- this.summaryConfirm.type = "button";
- this.summaryConfirm.textContent = this.label("confirm");
- this.summaryConfirm.addEventListener("click", () => void this.confirmSummarySelection());
- const cancelSummary = createElement("button", "b3-button b3-button--cancel");
- cancelSummary.type = "button";
- cancelSummary.textContent = this.label("cancel");
- cancelSummary.addEventListener("click", () => {
- this.cancelSummarySelection();
- this.updateSelection();
- });
- const summaryActions = createElement("div", "mindmap-view__summary-actions");
- summaryActions.append(cancelSummary, this.summaryConfirm);
- this.summaryControls.append(this.summaryCount, summaryActions);
- options.host.append(this.summaryControls);
- this.summaryBox.hidden = true;
- this.viewport.append(this.summaryBox);
+ this.selectionBox.hidden = true;
+ this.viewport.append(this.selectionBox);
this.createToolbar();
this.listen(document, "pointerdown", this.dismissControls, {capture: true});
this.listen(options.host, "pointerdown", this.activatePointer, {capture: true});
@@ -401,7 +376,7 @@ export class ListMindmapView {
return;
}
this.tooltipButton = button;
- this.tooltip.textContent = button.getAttribute("aria-label");
+ this.tooltip.textContent = button.dataset.tooltip || button.getAttribute("aria-label");
this.tooltip.hidden = false;
const host = this.options.host.getBoundingClientRect();
const rect = button.getBoundingClientRect();
@@ -422,8 +397,9 @@ export class ListMindmapView {
private clearSelection() {
this.inspector.hidden = true;
+ this.summaryStatus.hidden = true;
if (!this.selectedId && !this.selectedRelation && !this.selectedEdge && !this.relationFrom &&
- !this.selectedSummary && !this.summarySelecting) {
+ !this.selectedSummary) {
return;
}
this.selectedId = undefined;
@@ -431,7 +407,6 @@ export class ListMindmapView {
this.selectedEdge = undefined;
this.relationFrom = undefined;
this.selectedSummary = undefined;
- this.cancelSummarySelection();
this.updateSelection();
}
@@ -444,9 +419,6 @@ export class ListMindmapView {
if ((this.editingId || this.isTemporaryPan(event)) && this.isPanTarget(event)) {
return;
}
- if (this.summarySelecting && (this.viewport.contains(target) || this.summaryControls.contains(target))) {
- return;
- }
if ((event.ctrlKey || event.metaKey) && event.button === 0 && this.viewport.contains(target)) {
return;
}
@@ -455,7 +427,7 @@ export class ListMindmapView {
}
if (this.inspector.contains(target) || this.buttons.get("style")?.contains(target) ||
this.buttons.get("relation")?.contains(target) || this.buttons.get("expandLevel")?.contains(target) ||
- this.buttons.get("summary")?.contains(target) ||
+ this.buttons.get("summary")?.contains(target) || this.buttons.get("multiSelect")?.contains(target) ||
this.levelSelect?.contains(target)) {
return;
}
@@ -510,14 +482,15 @@ export class ListMindmapView {
this.interactionActive = value;
this.options.host.classList.toggle("mindmap-view--active", value);
if (!value) {
- const selecting = !!this.relationFrom || this.summarySelecting;
+ this.summaryStatus.hidden = true;
+ const selecting = !!this.relationFrom || this.multiSelect;
+ this.multiSelect = false;
this.pinching = false;
this.pinch = undefined;
this.cancelPointer();
this.setPanning(false);
this.relationFrom = undefined;
this.relationPreview = undefined;
- this.cancelSummarySelection();
this.inspector.hidden = true;
if (selecting) {
this.updateSelection();
@@ -542,7 +515,8 @@ export class ListMindmapView {
private refreshControls() {
const value = !!this.readOnly;
this.finishSummaryEdit?.(false);
- this.cancelSummarySelection();
+ this.multiSelect = false;
+ this.summaryStatus.hidden = true;
this.cancelPointer();
this.relationFrom = undefined;
this.inspector.hidden = true;
@@ -599,29 +573,24 @@ export class ListMindmapView {
return;
}
if (!this.readOnly) {
- add("summary", "listMindmapSummary", "iconGroups", () => {
- this.finishThen(() => {
- this.setInteractionActive(true);
- const selecting = !this.summarySelecting;
- this.cancelPointer();
- this.cancelSummarySelection();
- this.setPanning(false);
- this.inspector.hidden = true;
- this.relationFrom = undefined;
- this.summarySelecting = selecting;
- if (selecting) {
- this.summarySnapshot = getListMindmapSummarySnapshot(this.model);
- this.summaryFrom = getListMindmapSummaryRange(this.model, this.selectedId, this.selectedId).length ?
- this.selectedId : undefined;
- }
- this.updateSelection();
- });
- }, true);
+ add("multiSelect", "multiSelect", "iconSelect", () => {
+ this.setInteractionActive(true);
+ this.cancelPointer();
+ this.setPanning(false);
+ if (!this.multiSelect && this.inspector.hidden) {
+ this.clearSelection();
+ }
+ this.relationFrom = undefined;
+ this.multiSelect = !this.multiSelect;
+ 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.cancelSummarySelection();
this.setPanning(false);
this.inspector.hidden = true;
+ this.multiSelect = false;
this.relationFrom = this.relationFrom ? undefined : this.selectedId;
this.relationPreview = undefined;
this.updateSelection();
@@ -713,7 +682,7 @@ export class ListMindmapView {
private setPanning(value: boolean) {
if (value) {
- this.cancelSummarySelection();
+ this.multiSelect = false;
}
this.panning = value;
this.options.host.classList.toggle("mindmap-view--pan", value);
@@ -727,7 +696,7 @@ export class ListMindmapView {
}
public update(model: ListMindmapModel) {
- if (this.pointer?.relation || this.pointer?.summary || this.pointer?.selection || this.pointer?.touchNode) {
+ if (this.pointer?.relation || this.pointer?.selection || this.pointer?.touchNode) {
this.cancelPointer();
}
if (this.destroyed) {
@@ -745,7 +714,6 @@ export class ListMindmapView {
this.persistedLocked = !!model.metadata.viewLocked;
this.setLocked(this.persistedLocked);
}
- this.cancelSummarySelection();
if (this.levelSelect) {
const placeholder = new Option(this.label("expandLevel"), "");
placeholder.disabled = true;
@@ -1040,16 +1008,13 @@ export class ListMindmapView {
});
let bottom = viewport.bottom - marginY;
// 底部浮层按实际尺寸避让,横向定位后仍不相交的节点无需额外上移。
- [this.inspector, this.summaryControls].forEach(panel => {
- if (panel.hidden) {
- return;
- }
- const bounds = panel.getBoundingClientRect();
+ if (!this.inspector.hidden) {
+ const bounds = this.inspector.getBoundingClientRect();
if (bounds.width && bounds.height && bounds.bottom > viewport.top && bounds.top < viewport.bottom &&
rect.left + x < bounds.right && rect.right + x > bounds.left) {
bottom = Math.min(bottom, bounds.top - marginY);
}
- });
+ }
// 可用高度不足以完整显示节点时,优先保留节点顶部的正文。
const y = rect.top < top ? top - rect.top :
rect.bottom > bottom ? Math.max(top - rect.top, bottom - rect.bottom) : 0;
@@ -1333,77 +1298,41 @@ export class ListMindmapView {
this.selectedRelation = undefined;
this.selectedEdge = undefined;
this.relationFrom = undefined;
- this.cancelSummarySelection();
this.inspector.hidden = !!this.readOnly;
this.updateSelection();
this.renderInspector();
}
- private finishSummaryRange(id: string) {
- const from = this.summaryFrom;
- if (!from || !getListMindmapSummaryRange(this.model, from, id).length) {
+ private async createSummary() {
+ if (this.readOnly || this.summaryPending || !this.options.onSummaryBatchAdd) {
return;
}
- this.cancelSummarySelection();
+ const selected = this.getSelectedIds();
+ const {ranges, conflict} = getListMindmapSummarySelection(this.model, new Set(selected));
+ if (conflict || !ranges.length) {
+ return;
+ }
+ const expected = getListMindmapSummarySnapshot(this.model);
+ this.summaryPending = true;
this.updateSelection();
- void this.options.onSummaryAdd?.(from, id).then(summaryId => {
- if (summaryId && !this.destroyed) {
- this.selectSummary(summaryId);
+ try {
+ const ids = await this.options.onSummaryBatchAdd(ranges, expected);
+ if (!this.destroyed && !this.readOnly && ids?.length === 1 &&
+ JSON.stringify(this.getSelectedIds()) === JSON.stringify(selected)) {
+ this.selectSummary(ids[0]);
requestAnimationFrame(() => {
- if (!this.destroyed && this.selectedSummary === summaryId) {
- this.editSummaryLabel(summaryId);
+ if (!this.destroyed && this.selectedSummary === ids[0]) {
+ this.editSummaryLabel(ids[0]);
}
});
}
- }).catch(error => console.error(error));
- }
-
- private cancelSummarySelection() {
- this.summarySelecting = false;
- this.summaryFrom = undefined;
- this.summarySnapshot = undefined;
- this.summarySelected.clear();
- this.summaryRanges = [];
- this.summaryControls.hidden = true;
- this.summaryBox.hidden = true;
- }
-
- private previewSummarySelection() {
- const {ranges, conflict} = getListMindmapSummarySelection(this.model, this.summarySelected);
- this.summaryRanges = ranges;
- this.summaryConfirm.disabled = conflict || !ranges.length || !this.options.onSummaryBatchAdd;
- this.summaryCount.textContent = conflict ? this.label("listMindmapSummaryConflict") :
- this.label("listMindmapSummaryBatch").replace("${count}", String(ranges.length));
- this.summaryControls.hidden = false;
- this.updateSelection();
- }
-
- private async confirmSummarySelection() {
- if (!this.summarySelecting || this.summaryConfirm.disabled || this.readOnly) {
- return;
- }
- const ranges = this.summaryRanges;
- const expected = this.summarySnapshot;
- this.summaryConfirm.disabled = true;
- let ids: string[];
- try {
- ids = await this.options.onSummaryBatchAdd?.(ranges, expected);
} catch (error) {
console.error(error);
- }
- if (this.destroyed) {
- return;
- }
- this.cancelSummarySelection();
- if (ids?.length === 1) {
- this.selectSummary(ids[0]);
- requestAnimationFrame(() => {
- if (!this.destroyed && this.selectedSummary === ids[0]) {
- this.editSummaryLabel(ids[0]);
- }
- });
- } else {
- this.updateSelection();
+ } finally {
+ this.summaryPending = false;
+ if (!this.destroyed) {
+ this.updateSelection();
+ }
}
}
@@ -1487,10 +1416,14 @@ export class ListMindmapView {
}
private drawSummaryPreview(context: CanvasRenderingContext2D, color: string) {
- if (!this.summarySelecting || this.printTransform || this.options.printLayout || !this.summaryRanges.length) {
+ if (this.readOnly || this.inspector.hidden || this.printTransform || this.options.printLayout) {
return;
}
- const previews = this.summaryRanges.map((range, index) => ({...range, id: `preview:${index}`, label: ""}));
+ const {ranges, conflict} = getListMindmapSummarySelection(this.model, new Set(this.getSelectedIds()));
+ if (conflict || !ranges.length) {
+ return;
+ }
+ const previews = ranges.map((range, index) => ({...range, id: `preview:${index}`, label: ""}));
const sizes = new Map([...this.summaryPositions].map(([id, position]) =>
[id, {width: position.width, height: position.height}]));
previews.forEach(preview => sizes.set(preview.id, {width: 0, height: 0}));
@@ -1529,7 +1462,6 @@ export class ListMindmapView {
this.finishThen(() => {
this.selectedRelation = relation.id;
this.selectedSummary = undefined;
- this.cancelSummarySelection();
this.selectedEdge = undefined;
this.relationFrom = undefined;
this.selectedId = undefined;
@@ -2116,10 +2048,10 @@ export class ListMindmapView {
this.selectedSummary = undefined;
this.selectedRelation = undefined;
this.selectedEdge = undefined;
- this.updateSelection();
- if (!this.readOnly && !this.relationFrom && !this.summarySelecting) {
- this.inspector.hidden = false;
+ if (!this.readOnly && !this.relationFrom) {
+ this.inspector.hidden = !this.selectedId;
}
+ this.updateSelection();
if (changed || !this.inspector.hidden) {
this.renderInspector();
}
@@ -2133,18 +2065,18 @@ export class ListMindmapView {
this.relationPreview = undefined;
}
this.nodeElements.forEach((element, id) => {
- const selected = this.selectedId === id || this.selectedIds.has(id) || this.summarySelected.has(id);
+ const selected = this.selectedId === id || this.selectedIds.has(id);
element.classList.toggle("mindmap-view__node--selected", selected);
element.classList.toggle("mindmap-view__node--relation", this.relationFrom === id ||
- this.relationPreview?.targetId === id || !!this.summaryFrom &&
- getListMindmapSummaryRange(this.model, this.summaryFrom, id).length > 0);
+ this.relationPreview?.targetId === id);
element.setAttribute("aria-selected", String(selected));
});
this.relationElements.forEach((element, id) => element.classList.toggle("mindmap-view__relation--selected", this.selectedRelation === id));
const node = this.model.nodes.get(this.selectedId);
+ const {ranges, conflict} = getListMindmapSummarySelection(this.model, new Set(this.getSelectedIds()));
const disabled: Record<string, boolean> = {
relation: !node || node.virtual || this.getSelectedIds().length > 1,
- summary: false,
+ summary: this.readOnly || this.summaryPending || conflict || !ranges.length || !this.options.onSummaryBatchAdd,
style: !node && !this.selectedRelation && !this.selectedEdge,
};
Object.keys(disabled).forEach((key) => {
@@ -2154,10 +2086,16 @@ export class ListMindmapView {
}
});
this.buttons.get("relation")?.classList.toggle("block__icon--active", !!this.relationFrom);
- this.buttons.get("summary")?.classList.toggle("block__icon--active", this.summarySelecting);
- this.buttons.get("summary")?.setAttribute("aria-pressed", String(this.summarySelecting));
- this.summaryStatus.hidden = !this.summarySelecting || !this.summaryControls.hidden;
- this.viewport.classList.toggle("mindmap-view__viewport--summary", this.summarySelecting);
+ const summary = this.buttons.get("summary");
+ if (summary) {
+ const description = conflict ? this.label("listMindmapSummaryConflict") :
+ this.label("listMindmapSummaryBatch").replace("${count}", String(ranges.length));
+ summary.dataset.tooltip = description;
+ summary.setAttribute("aria-description", description);
+ }
+ this.buttons.get("multiSelect")?.classList.toggle("block__icon--active", this.multiSelect);
+ this.buttons.get("multiSelect")?.setAttribute("aria-pressed", String(this.multiSelect));
+ this.summaryStatus.hidden = !conflict || this.inspector.hidden;
this.draw();
}
@@ -2230,7 +2168,6 @@ export class ListMindmapView {
}
this.selectedId = selected.id;
this.selectedSummary = undefined;
- this.cancelSummarySelection();
this.selectedRelation = undefined;
this.selectedEdge = undefined;
this.relationFrom = undefined;
@@ -2338,7 +2275,7 @@ export class ListMindmapView {
public isPanTarget(event: PointerEvent) {
const target = event.target as HTMLElement;
- return !this.locked && !this.pinching && (event.button === 1 || event.button === 2 || !this.summarySelecting && !this.relationFrom) &&
+ return !this.locked && !this.pinching && (event.button === 1 || event.button === 2 || !this.relationFrom) &&
(event.pointerType !== "touch" || this.interactionActive || !!this.fullscreenMarker) &&
(event.pointerType !== "touch" || event.isPrimary) && [0, 1, 2].includes(event.button) &&
this.viewport.contains(target) && target.closest(".mindmap-view") === this.options.host &&
@@ -2392,41 +2329,6 @@ export class ListMindmapView {
}
private beginPointer(event: PointerEvent, id?: string) {
- if (this.summarySelecting && !this.readOnly && event.button === 0 && !this.panning) {
- event.preventDefault();
- this.suppressLinkClick = true;
- if (id) {
- if (this.summaryFrom) {
- this.finishSummaryRange(id);
- } else if (!this.model.nodes.get(id)?.virtual && getListMindmapSummaryParentID(this.model, id)) {
- if (this.summarySelected.has(id)) {
- this.summarySelected.delete(id);
- } else {
- this.summarySelected.add(id);
- }
- this.selectedId = undefined;
- this.previewSummarySelection();
- }
- this.cancelPointer();
- return;
- }
- this.summaryFrom = undefined;
- this.selectedId = undefined;
- this.summarySelected.clear();
- this.summaryRanges = [];
- this.summaryControls.hidden = true;
- this.options.host.focus({preventScroll: true});
- this.pointer = {pointerId: event.pointerId, startX: event.clientX, startY: event.clientY,
- x: this.offsetX, y: this.offsetY, moved: false, summary: true};
- try {
- this.pointerCapture = this.viewport;
- this.viewport.setPointerCapture(event.pointerId);
- } catch {
- this.cancelPointer();
- }
- this.updateSelection();
- return;
- }
if (this.panning || event.button === 1 || event.button === 2) {
id = undefined;
event.preventDefault();
@@ -2517,7 +2419,7 @@ export class ListMindmapView {
pointer.touchDragTimer = window.setTimeout(() => {
pointer.touchDragTimer = undefined;
if (this.pointer !== pointer || pointer.moved || this.readOnly || this.pinching || this.panning ||
- this.multiSelect || this.summarySelecting || this.relationFrom ||
+ this.multiSelect || this.relationFrom ||
this.destroyed || !this.model.nodes.has(pointer.touchNode)) {
return;
}
@@ -2581,8 +2483,8 @@ export class ListMindmapView {
const right = Math.max(pointer.startX, event.clientX);
const top = Math.min(pointer.startY, event.clientY);
const bottom = Math.max(pointer.startY, event.clientY);
- this.summaryBox.hidden = false;
- this.summaryBox.style.cssText = `left:${left - viewport.left}px;top:${top - viewport.top}px;` +
+ this.selectionBox.hidden = false;
+ this.selectionBox.style.cssText = `left:${left - viewport.left}px;top:${top - viewport.top}px;` +
`width:${right - left}px;height:${bottom - top}px`;
this.selectedIds.clear();
pointer.selection.forEach(id => this.selectedIds.add(id));
@@ -2602,31 +2504,6 @@ export class ListMindmapView {
this.updateSelection();
return;
}
- if (pointer.summary) {
- const viewport = this.viewport.getBoundingClientRect();
- const left = Math.min(pointer.startX, event.clientX);
- const right = Math.max(pointer.startX, event.clientX);
- const top = Math.min(pointer.startY, event.clientY);
- const bottom = Math.max(pointer.startY, event.clientY);
- this.summaryBox.hidden = false;
- this.summaryBox.style.left = `${left - viewport.left}px`;
- this.summaryBox.style.top = `${top - viewport.top}px`;
- this.summaryBox.style.width = `${right - left}px`;
- this.summaryBox.style.height = `${bottom - top}px`;
- this.summarySelected.clear();
- this.positions.forEach((position, id) => {
- const node = this.model.nodes.get(id);
- const x = viewport.left + this.offsetX + (position.x + position.width / 2) * this.scale;
- const y = viewport.top + this.offsetY + (position.y - (id === this.model.root.id ? 1 : 3) +
- position.height / 2) * this.scale;
- if (!node.virtual && getListMindmapSummaryParentID(this.model, id) &&
- x >= left && x <= right && y >= top && y <= bottom) {
- this.summarySelected.add(id);
- }
- });
- this.previewSummarySelection();
- return;
- }
if (pointer.relation) {
const drag = pointer.relation;
if (drag.endpoint) {
@@ -2747,16 +2624,10 @@ export class ListMindmapView {
this.suppressLinkClick = true;
this.cancelPointer();
this.inspector.hidden = !this.selectedId || this.readOnly;
+ this.updateSelection();
this.renderInspector();
return;
}
- if (pointer.summary) {
- this.suppressLinkClick = true;
- pointer.summary = false;
- this.cancelPointer();
- this.previewSummarySelection();
- return;
- }
if (pointer.relation) {
if (moved) {
this.previewRouteDrag();
@@ -2859,7 +2730,6 @@ export class ListMindmapView {
return;
}
this.selectedSummary = undefined;
- this.cancelSummarySelection();
this.selectedId = undefined;
this.relationFrom = undefined;
this.selectedRelation = line.relation ? line.id : undefined;
@@ -2886,13 +2756,7 @@ export class ListMindmapView {
this.pointer = undefined;
clearTimeout(pointer?.touchDragTimer);
pointer?.hiddenControls?.forEach(element => element.classList.remove("mindmap-view__node--hide-controls"));
- this.summaryBox.hidden = true;
- if (pointer?.summary) {
- this.summarySelected.clear();
- this.summaryRanges = [];
- this.summaryControls.hidden = true;
- this.updateSelection();
- }
+ this.selectionBox.hidden = true;
if (pointer && this.pointerCapture?.hasPointerCapture(pointer.pointerId)) {
this.pointerCapture.releasePointerCapture(pointer.pointerId);
}
@@ -2923,7 +2787,7 @@ export class ListMindmapView {
return;
}
clearTimeout(this.linkTimer);
- if (this.panning || this.suppressLinkClick || this.relationFrom || this.summarySelecting || event.detail > 1) {
+ if (this.panning || this.suppressLinkClick || this.relationFrom || this.multiSelect || event.detail > 1) {
event.preventDefault();
return;
}
@@ -2946,7 +2810,7 @@ export class ListMindmapView {
private doubleClick = (event: MouseEvent) => {
clearTimeout(this.linkTimer);
- if (this.relationFrom || this.summarySelecting || this.panning || this.pinching) {
+ if (this.relationFrom || this.multiSelect || this.panning || this.pinching) {
return;
}
const target = event.target as HTMLElement;
@@ -3255,7 +3119,7 @@ export class ListMindmapView {
private copySelection = (event: ClipboardEvent) => {
const cut = event.type === "cut";
- if (event.defaultPrevented || this.editingId || this.relationFrom || this.summarySelecting ||
+ if (event.defaultPrevented || this.editingId || this.relationFrom ||
cut && this.readOnly || !this.options.onCopy || !this.getSelectedIds().length ||
(event.target as HTMLElement).isContentEditable ||
(event.target as HTMLElement).closest("input, textarea, select")) {
@@ -3266,7 +3130,7 @@ export class ListMindmapView {
};
private pasteSelection = (event: ClipboardEvent) => {
- if (event.defaultPrevented || this.readOnly || this.editingId || this.relationFrom || this.summarySelecting ||
+ if (event.defaultPrevented || this.readOnly || this.editingId || this.relationFrom ||
!this.options.onPaste || this.getSelectedIds().length !== 1 ||
(event.target as HTMLElement).isContentEditable ||
(event.target as HTMLElement).closest("input, textarea, select")) {
@@ -3309,13 +3173,13 @@ export class ListMindmapView {
this.viewport.contains(target.closest(".mindmap-view__node--editing"))) {
return;
}
- if (this.summaryControls.contains(target) && target.closest("button") && event.key !== "Escape") {
+ if (target.closest("button") && (event.key === "Enter" || event.key === " ")) {
return;
}
if (this.pointer?.relation && event.key !== "Escape") {
return;
}
- if (!startingComposition && !this.editingId && !this.summarySelecting && !this.relationFrom &&
+ if (!startingComposition && !this.editingId && !this.relationFrom &&
(event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey &&
["c", "x"].includes(event.key.toLowerCase()) && this.options.onCopy && this.getSelectedIds().length) {
const cut = event.key.toLowerCase() === "x";
@@ -3327,7 +3191,7 @@ export class ListMindmapView {
return;
}
if (!startingComposition && (event.ctrlKey || event.metaKey) && !event.altKey &&
- event.key.toLowerCase() === "v" && !this.editingId && !this.summarySelecting && !this.relationFrom &&
+ event.key.toLowerCase() === "v" && !this.editingId && !this.relationFrom &&
!this.readOnly && this.options.onPaste && this.getSelectedIds().length === 1) {
this.pasteSibling = event.shiftKey;
// Shift+V 在部分宿主中会被解释为纯文本粘贴,直接读取完整载荷以保留节点结构。
@@ -3339,31 +3203,6 @@ export class ListMindmapView {
event.stopPropagation();
return;
}
- if (this.summarySelecting && event.key !== "Escape") {
- if (startingComposition || event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) {
- return;
- }
- if (event.key === "Enter") {
- if (this.summaryFrom) {
- this.finishSummaryRange(this.selectedId);
- } else {
- void this.confirmSummarySelection();
- }
- } else if (this.summaryFrom && (event.key === "ArrowUp" || event.key === "ArrowDown")) {
- const parent = this.model.nodes.get(this.model.nodes.get(this.summaryFrom)?.parentId);
- const index = parent?.children.findIndex(node => node.id === this.selectedId) ?? -1;
- const next = parent?.children[index + (event.key === "ArrowUp" ? -1 : 1)];
- if (next) {
- this.selectNode(next.id);
- this.revealNode(next.id);
- }
- } else {
- return;
- }
- event.preventDefault();
- event.stopPropagation();
- return;
- }
const noModifiers = !event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey;
const siblingShortcut = !startingComposition &&
(event.key === "Enter" && noModifiers || this.options.isAddSiblingShortcut?.(event));
@@ -3492,7 +3331,6 @@ export class ListMindmapView {
});
} else if (!startingComposition && event.key === "Escape") {
const draggingRoute = !!this.pointer?.relation;
- const selectingSummary = this.summarySelecting;
this.cancelPointer();
if (draggingRoute) {
event.preventDefault();
@@ -3501,11 +3339,10 @@ export class ListMindmapView {
}
this.relationFrom = undefined;
this.multiSelect = false;
- this.cancelSummarySelection();
this.inspector.hidden = true;
- if (this.fullscreenMarker && !selectingSummary) {
+ if (this.fullscreenMarker) {
this.exitFullscreen();
- } else if (!selectingSummary) {
+ } else {
this.setInteractionActive(false);
}
this.updateSelection();
@@ -3606,13 +3443,6 @@ export class ListMindmapView {
const id = this.selectedId;
const ids = this.getSelectedIds();
const multiple = ids.length > 1;
- const select = squareButton("multiSelect", "iconSelect", () => {
- this.multiSelect = !this.multiSelect;
- this.renderInspector();
- });
- select.setAttribute("aria-pressed", String(this.multiSelect));
- select.classList.toggle("color__square--current", this.multiSelect);
- this.inspector.append(select);
const appendMore = () => {
if (this.options.onClipboardMenu) {
const more = squareButton("more", "iconMore", () => this.options.onClipboardMenu(more, ids));
@@ -3621,17 +3451,12 @@ export class ListMindmapView {
this.inspector.append(more);
}
};
- if (multiple) {
- 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(remove);
- }
+ 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);
const change = (patch: Partial<ListMindmapNodeStyle>) => multiple ? this.options.onNodesStyle?.(ids, patch) :
this.options.onNodeStyle?.(id, patch);
- if (!multiple) {
- this.inspector.append(this.buttons.get("relation"), this.buttons.get("summary"));
- }
const nodePalette = createElement("div", "mindmap-view__palette");
nodePalette.setAttribute("role", "group");
nodePalette.setAttribute("aria-label", this.label("color"));
@@ -3669,9 +3494,6 @@ export class ListMindmapView {
const task = squareButton("checkToggle", "iconCheck", () => this.openTaskMenu(id, task));
this.inspector.append(task);
}
- if (node && !node.virtual && node !== this.model.root) {
- this.inspector.append(squareButton("delete", "iconTrashcan", () => this.deleteSelection()));
- }
appendMore();
}
diff --git a/app/src/protyle/render/listMindmap/viewportFocus.test.ts b/app/src/protyle/render/listMindmap/viewportFocus.test.ts
index 9877a29c4e..961e605b72 100644
--- a/app/src/protyle/render/listMindmap/viewportFocus.test.ts
+++ b/app/src/protyle/render/listMindmap/viewportFocus.test.ts
@@ -25,7 +25,7 @@ const setup = () => {
const host = {focus: () => focus = "canvas", contains: () => true};
const target = Object.assign(new context.View(), {
options: {host}, editingId: "new", model: {nodes: new Map([["new", {}]])},
- selectedId: "new", tooltip: {}, inspector: {hidden: true}, summaryControls: {hidden: true},
+ selectedId: "new", tooltip: {}, inspector: {hidden: true},
toolbar: {hidden: false, querySelectorAll: (): unknown[] => []},
world: {querySelectorAll: (): HTMLElement[] => []},
nodeElements: new Map(), offsetX: 0, offsetY: 0,
@@ -83,21 +83,19 @@ test("focusing visible, missing or removed nodes does not pan", () => {
});
test("node focus avoids the actual bottom panel bounds after the pending layout", () => {
- for (const panel of ["inspector", "summaryControls"]) {
- for (const top of [250, 210]) {
- const {target, frames, drawn} = setup();
- target.frame = 1;
- target[panel] = {hidden: false, getBoundingClientRect: () =>
- ({left: 80, right: 320, top, bottom: 292, width: 240, height: 292 - top})};
- target.nodeElements.set("new", {getBoundingClientRect: () =>
- ({left: 100, top: 240, right: 180, bottom: 280, width: 80, height: 40})});
- target.focusNode("new");
- assert.equal(drawn(), 0);
- frames.forEach(action => action());
- assert.equal(280 + target.offsetY, top - 16);
- assert.equal(target.offsetX, 0);
- assert.equal(drawn(), 1);
- }
+ for (const top of [250, 210]) {
+ const {target, frames, drawn} = setup();
+ target.frame = 1;
+ target.inspector = {hidden: false, getBoundingClientRect: () =>
+ ({left: 80, right: 320, top, bottom: 292, width: 240, height: 292 - top})};
+ target.nodeElements.set("new", {getBoundingClientRect: () =>
+ ({left: 100, top: 240, right: 180, bottom: 280, width: 80, height: 40})});
+ target.focusNode("new");
+ assert.equal(drawn(), 0);
+ frames.forEach(action => action());
+ assert.equal(280 + target.offsetY, top - 16);
+ assert.equal(target.offsetX, 0);
+ assert.equal(drawn(), 1);
}
});
@@ -288,7 +286,7 @@ test("middle dragging and Ctrl or Meta right dragging preserve reading state, no
assert.equal(target.pointer, undefined, "temporary gestures cannot bypass a saved view lock");
assert.equal(target.interactionActive, false);
assert.equal(finished(), 0);
- for (const mode of ["relationFrom", "summarySelecting"]) {
+ for (const mode of ["relationFrom", "multiSelect"]) {
const {target, event, finished} = setup();
target[mode] = mode === "relationFrom" ? "new" : true;
const down = event("background", overrides);
@@ -305,7 +303,7 @@ test("middle dragging and Ctrl or Meta right dragging preserve reading state, no
test("middle clicks preserve selection and editing without moving or finishing annotations", () => {
for (const kind of ["background", ".mindmap-view__node", ".mindmap-view__summary"]) {
- for (const mode of ["normal", "readOnly", "relationFrom", "summarySelecting"]) {
+ for (const mode of ["normal", "readOnly", "relationFrom"]) {
const {target, event, finished, focus} = setup();
if (mode !== "normal") {
target[mode] = mode === "relationFrom" ? "new" : true;
@@ -367,7 +365,7 @@ test("nodes, controls, nested maps, lines and non-pan modes retain their own int
target.findLine = () => ({relation: true});
assert.equal(target.isPanTarget(event()), false);
target.findLine = (): unknown => undefined;
- for (const key of ["locked", "pinching", "summarySelecting", "relationFrom"]) {
+ for (const key of ["locked", "pinching", "relationFrom"]) {
target[key] = true;
assert.equal(target.isPanTarget(event()), false, key);
target[key] = false;