An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Support mind map node selection and clipboard actions https://github.com/siyuan-note/siyuan/issues/20703
Danielc71b6a43fc7a
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.jsonindex 813a9cf685..dd3d17d5b4 100644--- a/app/appearance/langs/ar.json+++ b/app/appearance/langs/ar.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "لصق كعقدة فرعية",+ "mindmapPasteSibling": "لصق كعقدة شقيقة","embedBlockBreadcrumbParentPath": "إظهار المسار الأصل في مسار التنقل","closeWindowOnLastTabClosed": "إغلاق النافذة الجديدة مع آخر علامة تبويب","closeWindowOnLastTabClosedTip": "إغلاق النافذة الجديدة عند إغلاق آخر علامة تبويب فيها أو سحبها إلى نافذة أخرى",diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.jsonindex 12219609c9..314a414df0 100644--- a/app/appearance/langs/de.json+++ b/app/appearance/langs/de.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Als untergeordneten Knoten einfügen",+ "mindmapPasteSibling": "Als gleichgeordneten Knoten einfügen","embedBlockBreadcrumbParentPath": "Übergeordneten Pfad in der Brotkrumennavigation anzeigen","closeWindowOnLastTabClosed": "Neues Fenster mit dem letzten Tab schließen","closeWindowOnLastTabClosedTip": "Das neue Fenster schließen, wenn sein letzter Tab geschlossen oder in ein anderes Fenster gezogen wird",diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.jsonindex 70c3d00d29..a56a7bdac2 100644--- a/app/appearance/langs/en.json+++ b/app/appearance/langs/en.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Paste as child node",+ "mindmapPasteSibling": "Paste as sibling node","embedBlockBreadcrumbParentPath": "Show parent path in breadcrumbs","closeWindowOnLastTabClosed": "Close new window with last tab","closeWindowOnLastTabClosedTip": "Close the new window when its last tab is closed or dragged to another window",diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.jsonindex fffa970300..4849592dbc 100644--- a/app/appearance/langs/es.json+++ b/app/appearance/langs/es.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Pegar como nodo hijo",+ "mindmapPasteSibling": "Pegar como nodo hermano","embedBlockBreadcrumbParentPath": "Mostrar la ruta superior en la ruta de navegación","closeWindowOnLastTabClosed": "Cerrar la nueva ventana con la última pestaña","closeWindowOnLastTabClosedTip": "Cerrar la nueva ventana al cerrar su última pestaña o arrastrarla a otra ventana",diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.jsonindex 220021e51b..cd703b1126 100644--- a/app/appearance/langs/fr.json+++ b/app/appearance/langs/fr.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Coller comme nœud enfant",+ "mindmapPasteSibling": "Coller comme nœud de même niveau","embedBlockBreadcrumbParentPath": "Afficher le chemin parent dans le fil d'Ariane","closeWindowOnLastTabClosed": "Fermer la nouvelle fenêtre avec le dernier onglet","closeWindowOnLastTabClosedTip": "Fermer la nouvelle fenêtre lorsque son dernier onglet est fermé ou déplacé vers une autre fenêtre",diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.jsonindex 0fd2211ba0..de55e6fed8 100644--- a/app/appearance/langs/he.json+++ b/app/appearance/langs/he.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "הדבקה כצומת ילד",+ "mindmapPasteSibling": "הדבקה כצומת אח","embedBlockBreadcrumbParentPath": "הצגת נתיב האב בנתיב הניווט","closeWindowOnLastTabClosed": "סגירת החלון החדש עם הלשונית האחרונה","closeWindowOnLastTabClosedTip": "סגירת החלון החדש כאשר הלשונית האחרונה בו נסגרת או נגררת לחלון אחר",diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.jsonindex 299fc7e645..c2defd2ec2 100644--- a/app/appearance/langs/hi.json+++ b/app/appearance/langs/hi.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "चाइल्ड नोड के रूप में पेस्ट करें",+ "mindmapPasteSibling": "समान स्तर के नोड के रूप में पेस्ट करें","embedBlockBreadcrumbParentPath": "ब्रेडक्रंब में मूल पथ दिखाएँ","closeWindowOnLastTabClosed": "अंतिम टैब के साथ नई विंडो बंद करें","closeWindowOnLastTabClosedTip": "अंतिम टैब बंद होने या दूसरी विंडो में खींचे जाने पर नई विंडो बंद करें",diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.jsonindex b34daf5a49..a683efe99e 100644--- a/app/appearance/langs/id.json+++ b/app/appearance/langs/id.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Tempel sebagai simpul anak",+ "mindmapPasteSibling": "Tempel sebagai simpul sejajar","embedBlockBreadcrumbParentPath": "Tampilkan jalur induk di remah roti","closeWindowOnLastTabClosed": "Tutup jendela baru bersama tab terakhir","closeWindowOnLastTabClosedTip": "Tutup jendela baru saat tab terakhirnya ditutup atau diseret ke jendela lain",diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.jsonindex b79bbfdc74..404d522de6 100644--- a/app/appearance/langs/it.json+++ b/app/appearance/langs/it.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Incolla come nodo figlio",+ "mindmapPasteSibling": "Incolla come nodo allo stesso livello","embedBlockBreadcrumbParentPath": "Mostra il percorso superiore nelle briciole di pane","closeWindowOnLastTabClosed": "Chiudi la nuova finestra con l'ultima scheda","closeWindowOnLastTabClosedTip": "Chiudi la nuova finestra quando l'ultima scheda viene chiusa o trascinata in un'altra finestra",diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.jsonindex 90da4397f9..0bdc1d38d7 100644--- a/app/appearance/langs/ja.json+++ b/app/appearance/langs/ja.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "子ノードとして貼り付け",+ "mindmapPasteSibling": "同階層のノードとして貼り付け","embedBlockBreadcrumbParentPath": "パンくずリストに文書の上位パスを表示","closeWindowOnLastTabClosed": "最後のタブとともに新しいウィンドウを閉じる","closeWindowOnLastTabClosedTip": "新しいウィンドウの最後のタブを閉じるか別のウィンドウへドラッグしたときに、そのウィンドウを閉じます",diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.jsonindex c63d918728..94a8e8bc76 100644--- a/app/appearance/langs/ko.json+++ b/app/appearance/langs/ko.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "하위 노드로 붙여넣기",+ "mindmapPasteSibling": "같은 수준의 노드로 붙여넣기","embedBlockBreadcrumbParentPath": "탐색 경로에 문서의 상위 경로 표시","closeWindowOnLastTabClosed": "마지막 탭과 함께 새 창 닫기","closeWindowOnLastTabClosedTip": "새 창의 마지막 탭을 닫거나 다른 창으로 드래그하면 해당 창 닫기",diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.jsonindex f0ac674653..c36bbdc9d9 100644--- a/app/appearance/langs/nl.json+++ b/app/appearance/langs/nl.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Plakken als onderliggend knooppunt",+ "mindmapPasteSibling": "Plakken als knooppunt op hetzelfde niveau","embedBlockBreadcrumbParentPath": "Bovenliggend pad in het kruimelpad tonen","closeWindowOnLastTabClosed": "Nieuw venster sluiten met het laatste tabblad","closeWindowOnLastTabClosedTip": "Sluit het nieuwe venster wanneer het laatste tabblad wordt gesloten of naar een ander venster wordt gesleept",diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.jsonindex 050c62d84a..8a794d7c85 100644--- a/app/appearance/langs/pl.json+++ b/app/appearance/langs/pl.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Wklej jako węzeł podrzędny",+ "mindmapPasteSibling": "Wklej jako węzeł równorzędny","embedBlockBreadcrumbParentPath": "Pokaż ścieżkę nadrzędną w nawigacji okruszkowej","closeWindowOnLastTabClosed": "Zamknij nowe okno wraz z ostatnią kartą","closeWindowOnLastTabClosedTip": "Zamknij nowe okno po zamknięciu jego ostatniej karty lub przeciągnięciu jej do innego okna",diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.jsonindex e12891e2f9..4111d9d02d 100644--- a/app/appearance/langs/pt-BR.json+++ b/app/appearance/langs/pt-BR.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Colar como nó filho",+ "mindmapPasteSibling": "Colar como nó irmão","embedBlockBreadcrumbParentPath": "Mostrar o caminho superior na trilha de navegação","closeWindowOnLastTabClosed": "Fechar a nova janela com a última aba","closeWindowOnLastTabClosedTip": "Fechar a nova janela quando sua última aba for fechada ou arrastada para outra janela",diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.jsonindex 6de8ce89bd..65f7c52641 100644--- a/app/appearance/langs/ru.json+++ b/app/appearance/langs/ru.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Вставить как дочерний узел",+ "mindmapPasteSibling": "Вставить как узел того же уровня","embedBlockBreadcrumbParentPath": "Показывать родительский путь в навигационной цепочке","closeWindowOnLastTabClosed": "Закрывать новое окно вместе с последней вкладкой","closeWindowOnLastTabClosedTip": "Закрывать новое окно при закрытии его последней вкладки или её перетаскивании в другое окно",diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.jsonindex 131d78307a..5ffcf423f9 100644--- a/app/appearance/langs/sk.json+++ b/app/appearance/langs/sk.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Prilepiť ako podradený uzol",+ "mindmapPasteSibling": "Prilepiť ako uzol rovnakej úrovne","embedBlockBreadcrumbParentPath": "Zobraziť nadradenú cestu v navigačnej ceste","closeWindowOnLastTabClosed": "Zavrieť nové okno s poslednou kartou","closeWindowOnLastTabClosedTip": "Zavrieť nové okno po zatvorení jeho poslednej karty alebo jej presunutí do iného okna",diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.jsonindex 25adddcca3..404f71e668 100644--- a/app/appearance/langs/sr.json+++ b/app/appearance/langs/sr.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Налепи као подређени чвор",+ "mindmapPasteSibling": "Налепи као чвор истог нивоа","embedBlockBreadcrumbParentPath": "Прикажи надређену путању у навигационој путањи","closeWindowOnLastTabClosed": "Затвори нови прозор са последњом картицом","closeWindowOnLastTabClosedTip": "Затвори нови прозор када се његова последња картица затвори или превуче у други прозор",diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.jsonindex 3c5218baec..3cbaca6995 100644--- a/app/appearance/langs/th.json+++ b/app/appearance/langs/th.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "วางเป็นโหนดลูก",+ "mindmapPasteSibling": "วางเป็นโหนดระดับเดียวกัน","embedBlockBreadcrumbParentPath": "แสดงเส้นทางหลักในเส้นทางนำทาง","closeWindowOnLastTabClosed": "ปิดหน้าต่างใหม่พร้อมแท็บสุดท้าย","closeWindowOnLastTabClosedTip": "ปิดหน้าต่างใหม่เมื่อปิดแท็บสุดท้ายหรือลากแท็บนั้นไปยังหน้าต่างอื่น",diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.jsonindex 2b8dda54bf..21537e614a 100644--- a/app/appearance/langs/tr.json+++ b/app/appearance/langs/tr.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Alt düğüm olarak yapıştır",+ "mindmapPasteSibling": "Aynı düzeyde düğüm olarak yapıştır","embedBlockBreadcrumbParentPath": "Gezinti yolunda üst yolu göster","closeWindowOnLastTabClosed": "Son sekmeyle birlikte yeni pencereyi kapat","closeWindowOnLastTabClosedTip": "Son sekmesi kapatıldığında veya başka bir pencereye sürüklendiğinde yeni pencereyi kapat",diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.jsonindex b748f98d94..3c411a6912 100644--- a/app/appearance/langs/uk.json+++ b/app/appearance/langs/uk.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "Вставити як дочірній вузол",+ "mindmapPasteSibling": "Вставити як вузол того самого рівня","embedBlockBreadcrumbParentPath": "Показувати батьківський шлях у навігаційному ланцюжку","closeWindowOnLastTabClosed": "Закривати нове вікно разом з останньою вкладкою","closeWindowOnLastTabClosedTip": "Закривати нове вікно після закриття його останньої вкладки або перетягування її до іншого вікна",diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.jsonindex 2c6dba9573..ed3ee6c441 100644--- a/app/appearance/langs/zh-CN.json+++ b/app/appearance/langs/zh-CN.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "粘贴为子节点",+ "mindmapPasteSibling": "粘贴为同级节点","embedBlockBreadcrumbParentPath": "面包屑显示文档上层路径","closeWindowOnLastTabClosed": "新窗口随最后一个页签关闭","closeWindowOnLastTabClosedTip": "把新窗口的最后一个页签关闭或拖拽到其他窗口之后,关闭该窗口",diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.jsonindex 27f45c93ab..924377df6a 100644--- a/app/appearance/langs/zh-TW.json+++ b/app/appearance/langs/zh-TW.json@@ -1,4 +1,6 @@{+ "mindmapPasteChild": "貼上為子節點",+ "mindmapPasteSibling": "貼上為同層級節點","embedBlockBreadcrumbParentPath": "麵包屑顯示文件上層路徑","closeWindowOnLastTabClosed": "新視窗隨最後一個頁籤關閉","closeWindowOnLastTabClosedTip": "將新視窗的最後一個頁籤關閉或拖曳到其他視窗後,關閉該視窗",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 9d80def869..ec11bb4723 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": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -1961,7 +1961,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091509-v1x69oc",- "updated": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -2074,13 +2074,22 @@"Type": "NodeParagraph","Properties": {"id": "20261017110432-mq248cg",- "updated": "20261017113835"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText","Data": "In the mind map toolbar, use "},+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "More"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },{"Type": "NodeTextMark","TextMarkType": "kbd",@@ -3500,7 +3509,7 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-kkcg79g",- "updated": "20261012014859"+ "updated": "20261020162345"},"Children": [{@@ -3514,7 +3523,7 @@},{"Type": "NodeText",- "Data": " in the mind map toolbar, 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, 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."}]},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 70d074bf57..3b5bfe0d46 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": "20261018200107"+ "updated": "20261020162345"},"Children": [{@@ -13115,7 +13115,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-4zeuyl4",- "updated": "20261018200107"+ "updated": "20261020162345"},"HeadingLevel": 3,"Children": [@@ -13157,7 +13157,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-3srqnh0",- "updated": "20261017003000",+ "updated": "20261020162345","colgroup": "|"},"TableAligns": [@@ -13680,6 +13680,200 @@]}]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Copy selected node branches"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+C"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘C"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Cut selected node branches"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+X"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘X"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Paste as child nodes"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Paste as sibling nodes"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ }+ ]+ }+ ]+ }+ ]+ },+ {+ "ID": "20261020162345-sclp2zh",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261020162345-sclp2zh",+ "updated": "20261020162345"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Drag with the left mouse button on blank canvas to select several nodes. Hold "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl"+ },+ {+ "Type": "NodeText",+ "Data": " ("+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Command"+ },+ {+ "Type": "NodeText",+ "Data": " on macOS) and click a node to toggle its selection. On touch screens, select a node and enable "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Multi-select"+ },+ {+ "Type": "NodeText",+ "Data": " at the bottom, then tap nodes individually. Tap the button again or press "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Esc"+ },+ {+ "Type": "NodeText",+ "Data": " to leave this mode. Copy and cut include complete subtrees; selecting both a parent and its descendants copies the branch once. Copies retain node styles, internal connections and complete summaries. The root cannot be cut. Failed clipboard writes and systems that support only plain text leave the original nodes intact."}]},@@ -13688,21 +13882,57 @@"Type": "NodeParagraph","Properties": {"id": "20260930234403-5eh3gn8",- "updated": "20260930234403"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText",- "Data": "Paste an image with "+ "Data": "With one node selected, "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " pastes as child nodes, and "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " pastes as sibling nodes. The bottom "},{"Type": "NodeTextMark","TextMarkType": "kbd",- "TextMarkTextContent": "Ctrl+V / ⌘V"+ "TextMarkTextContent": "More"},{"Type": "NodeText",- "Data": " while editing a node, or after selecting a node to append it to the end of its visible content. Wait for an active upload to finish before leaving node editing."+ "Data": " menu also provides copy, cut and both paste actions. Copied mind map nodes retain their hierarchy; ordinary text, images and content blocks are inserted through a new node's editor. While editing node text, paste uses the normal content editor behavior. Wait for an image upload to finish before leaving node editing."}]},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 fd7fbc5630..106d02aad2 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": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -1964,7 +1964,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091228-wdpx6ev",- "updated": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -2077,13 +2077,22 @@"Type": "NodeParagraph","Properties": {"id": "20261017110432-6mghas7",- "updated": "20261017113835"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText","Data": "在脑图工具栏的 "},+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "更多"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },{"Type": "NodeTextMark","TextMarkType": "kbd",@@ -3503,12 +3512,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-8wl1iml",- "updated": "20261012014859"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText",- "Data": "选中范围的第一个节点,点击脑图工具栏中的 "+ "Data": "选中范围的第一个节点,点击底部节点菜单中的 "},{"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 409400889a..7223b9e630 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": "20261018200107"+ "updated": "20261020162345"},"Children": [{@@ -13097,7 +13097,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-hmrchvc",- "updated": "20261018200107"+ "updated": "20261020162345"},"HeadingLevel": 3,"Children": [@@ -13139,7 +13139,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-fr0uxw6",- "updated": "20261017003000",+ "updated": "20261020162345","colgroup": "|"},"TableAligns": [@@ -13750,6 +13750,200 @@]}]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "复制选中的节点分支"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+C"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘C"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "剪切选中的节点分支"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+X"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘X"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "粘贴为子节点"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "粘贴为同级节点"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ }+ ]+ }+ ]+ }+ ]+ },+ {+ "ID": "20261020162345-u2w43bx",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261020162345-u2w43bx",+ "updated": "20261020162345"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "在画布空白处按住鼠标左键拖动可框选多个节点;按住 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl"+ },+ {+ "Type": "NodeText",+ "Data": "(macOS 为 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Command"+ },+ {+ "Type": "NodeText",+ "Data": ")点击节点可切换其选中状态。触屏上先选中节点,再启用底部的 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "多选"+ },+ {+ "Type": "NodeText",+ "Data": ",即可逐个点选;再次点击该按钮或按 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Esc"+ },+ {+ "Type": "NodeText",+ "Data": " 退出多选模式。复制和剪切包含选中节点的完整子树,父子同时选中时只复制一次;副本保留节点样式、分支内部的连接和完整概括。根节点不能剪切;剪贴板写入失败或仅支持纯文本时,原节点会保留。"}]},@@ -13758,21 +13952,57 @@"Type": "NodeParagraph","Properties": {"id": "20260930234403-6bw63i6",- "updated": "20260930234403"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText",- "Data": "编辑节点时可按 "+ "Data": "选中一个节点后,"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " 将剪贴板内容粘贴为子节点,"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " 粘贴为同级节点。也可使用底部的 "},{"Type": "NodeTextMark","TextMarkType": "kbd",- "TextMarkTextContent": "Ctrl+V / ⌘V"+ "TextMarkTextContent": "更多"},{"Type": "NodeText",- "Data": " 粘贴图片;仅选中节点时粘贴,图片追加到当前可见正文末尾。上传进行中需等待完成后再退出节点编辑。"+ "Data": " 菜单执行复制、剪切和这两种粘贴。导图节点保留原有层级,普通文本、图片和内容块则通过新节点的编辑器插入。编辑节点文字时,粘贴沿用正文编辑行为;上传图片期间需等待上传完成再退出节点编辑。"}]},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 82b29556b8..7ead9ea871 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": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -1962,7 +1962,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226122008-731sqd6",- "updated": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -2075,13 +2075,22 @@"Type": "NodeParagraph","Properties": {"id": "20261017110432-qnsdugf",- "updated": "20261017113835"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText","Data": "在心智圖工具列的 "},+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "更多"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },{"Type": "NodeTextMark","TextMarkType": "kbd",@@ -3501,12 +3510,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-6pycwgr",- "updated": "20261012014859"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText",- "Data": "選取範圍的第一個節點,點選心智圖工具列中的 "+ "Data": "選取範圍的第一個節點,點選底部節點選單中的 "},{"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 c2e2b6bf4a..20912656a6 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": "20261018200107"+ "updated": "20261020162345"},"Children": [{@@ -13103,7 +13103,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-z0oyw36",- "updated": "20261018200107"+ "updated": "20261020162345"},"HeadingLevel": 3,"Children": [@@ -13145,7 +13145,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-f8y6pxv",- "updated": "20261017003000",+ "updated": "20261020162345","colgroup": "|"},"TableAligns": [@@ -13668,6 +13668,200 @@]}]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "複製選取的節點分支"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+C"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘C"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "剪下選取的節點分支"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+X"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘X"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "貼上為子節點"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "貼上為同層級節點"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ }+ ]+ }+ ]+ }+ ]+ },+ {+ "ID": "20261020162345-8p35hlz",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261020162345-8p35hlz",+ "updated": "20261020162345"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "在畫布空白處按住滑鼠左鍵拖曳可框選多個節點;按住 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl"+ },+ {+ "Type": "NodeText",+ "Data": "(macOS 為 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Command"+ },+ {+ "Type": "NodeText",+ "Data": ")點選節點可切換其選取狀態。觸控螢幕上先選取節點,再啟用底部的 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "多選"+ },+ {+ "Type": "NodeText",+ "Data": ",即可逐一點選;再次點選該按鈕或按 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Esc"+ },+ {+ "Type": "NodeText",+ "Data": " 離開多選模式。複製和剪下包含選取節點的完整子樹,父子同時選取時只複製一次;副本保留節點樣式、分支內部的連接和完整概要。根節點不能剪下;剪貼簿寫入失敗或僅支援純文字時,原節點會保留。"}]},@@ -13676,21 +13870,57 @@"Type": "NodeParagraph","Properties": {"id": "20260930234403-rg4uej3",- "updated": "20260930234403"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText",- "Data": "編輯節點時可按 "+ "Data": "選取一個節點後,"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " 將剪貼簿內容貼上為子節點,"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " 貼上為同層級節點。也可使用底部的 "},{"Type": "NodeTextMark","TextMarkType": "kbd",- "TextMarkTextContent": "Ctrl+V / ⌘V"+ "TextMarkTextContent": "更多"},{"Type": "NodeText",- "Data": " 貼上圖片;僅選取節點時貼上,圖片會附加到目前可見正文的末尾。上傳進行中需等待完成後再結束節點編輯。"+ "Data": " 選單執行複製、剪下和這兩種貼上。心智圖節點保留原有層級,普通文字、圖片和內容區塊則透過新節點的編輯器插入。編輯節點文字時,貼上沿用內文編輯行為;上傳圖片期間需等待上傳完成再離開節點編輯。"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.syindex 6914ae2a30..4be67cd19a 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": "20261018200107"+ "updated": "20261020162345"},"Children": [{@@ -13053,7 +13053,7 @@"Type": "NodeHeading","Properties": {"id": "20260921105011-icqlkb6",- "updated": "20261018200107"+ "updated": "20261020162345"},"HeadingLevel": 3,"Children": [@@ -13095,7 +13095,7 @@"Type": "NodeTable","Properties": {"id": "20260921105011-01k7syf",- "updated": "20261017003000",+ "updated": "20261020162345","colgroup": "|"},"TableAligns": [@@ -13618,6 +13618,200 @@]}]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "選択したノードの分岐をコピー"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+C"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘C"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "選択したノードの分岐を切り取り"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+X"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘X"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "子ノードとして貼り付け"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ }+ ]+ }+ ]+ },+ {+ "Type": "NodeTableRow",+ "Data": "tr",+ "Children": [+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeText",+ "Data": "同階層のノードとして貼り付け"+ }+ ]+ },+ {+ "Type": "NodeTableCell",+ "Data": "td",+ "Children": [+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ }+ ]+ }+ ]+ }+ ]+ },+ {+ "ID": "20261020162345-6y84piz",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261020162345-6y84piz",+ "updated": "20261020162345"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "キャンバスの空白部分をマウスの左ボタンでドラッグすると、複数のノードを範囲選択できます。"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl"+ },+ {+ "Type": "NodeText",+ "Data": "(macOS では "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Command"+ },+ {+ "Type": "NodeText",+ "Data": ")を押しながらノードをクリックすると、選択状態を切り替えられます。タッチ画面ではノードを選択し、下部の "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "複数選択"+ },+ {+ "Type": "NodeText",+ "Data": " を有効にしてからノードを個別にタップします。もう一度ボタンを押すか "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Esc"+ },+ {+ "Type": "NodeText",+ "Data": " を押すと、このモードを終了します。コピーと切り取りには子ツリー全体が含まれ、親と子を同時に選択しても重複しません。ノードのスタイル、分岐内の関連線、範囲全体が含まれる要約も保持します。ルートノードは切り取れません。クリップボードへの書き込みが失敗した場合やプレーンテキストしか扱えない環境では、元のノードを残します。"}]},@@ -13626,21 +13820,57 @@"Type": "NodeParagraph","Properties": {"id": "20260930234403-cyh3qk6",- "updated": "20260930234403"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText",- "Data": "ノードの編集中に "+ "Data": "ノードを 1 つ選択して "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " を押すと子ノードとして、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Ctrl+Shift+V"+ },+ {+ "Type": "NodeText",+ "Data": " / "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "⇧⌘V"+ },+ {+ "Type": "NodeText",+ "Data": " を押すと同階層のノードとして貼り付けます。下部の "},{"Type": "NodeTextMark","TextMarkType": "kbd",- "TextMarkTextContent": "Ctrl+V / ⌘V"+ "TextMarkTextContent": "詳細"},{"Type": "NodeText",- "Data": " で画像を貼り付けられます。ノードを選択した状態で貼り付けると、現在表示されている本文の末尾に画像が追加されます。アップロード中は完了を待ってからノードの編集を終了してください。"+ "Data": " メニューからもコピー、切り取り、これらの貼り付けを実行できます。マインドマップのノードは元の階層を保持し、通常のテキスト、画像、コンテンツブロックは新しいノードのエディタを通して挿入します。ノードのテキスト編集中は、通常の本文編集と同じ貼り付け動作になります。画像のアップロード中は完了を待ってからノードの編集を終了してください。"}]},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 20fbf7f618..f9457cf699 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": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -2090,7 +2090,7 @@"Properties": {"ID": "20240530101000-ch5e4vh","id": "20240530101000-1ev7xub",- "updated": "20261019201307"+ "updated": "20261020162345"},"Children": [{@@ -2203,13 +2203,22 @@"Type": "NodeParagraph","Properties": {"id": "20261017110432-562ro9u",- "updated": "20261017113835"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText","Data": "マインドマップのツールバーで "},+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "詳細"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },{"Type": "NodeTextMark","TextMarkType": "kbd",@@ -3622,12 +3631,12 @@"Type": "NodeParagraph","Properties": {"id": "20260926151827-vknoaqd",- "updated": "20261012014859"+ "updated": "20261020162345"},"Children": [{"Type": "NodeText",- "Data": "範囲の最初のノードを選択し、マインドマップのツールバーで "+ "Data": "範囲の最初のノードを選択し、下部のノードメニューで "},{"Type": "NodeTextMark",diff --git a/app/src/protyle/render/listMindmap/clipboard.test.ts b/app/src/protyle/render/listMindmap/clipboard.test.tsnew file mode 100644index 0000000000..44ad267489--- /dev/null+++ b/app/src/protyle/render/listMindmap/clipboard.test.ts@@ -0,0 +1,327 @@+import * as assert from "node:assert/strict";+import {execFile} from "node:child_process";+import {mkdtempSync, readFileSync, rmSync, writeFileSync} from "node:fs";+import {tmpdir} from "node:os";+import * as path from "node:path";+import test from "node:test";+import {promisify} from "node:util";+import * as ts from "typescript";++const browserCases = async (source: string, css: string) => {+ const check = require("node:assert/strict");+ const constants = {CUSTOM_SY_LIST_MINDMAP: "custom-sy-list-mindmap",+ CUSTOM_SY_LIST_MINDMAP_DATA: "custom-sy-list-mindmap-data", TIMEOUT_DBLCLICK: 200};+ const messages: string[] = [];+ let write: () => Promise<{status: string}> = async () => ({status: "rich"});+ let read: () => Promise<IClipboardData> = async () => ({});+ const api = new Function("Constants", "mathRender", "canEdit", "showMessage", "writeClipboardData",+ "readClipboard", "prepareExternalClipboardHTML", "removeZWJ", "getTabTask", "destroyTabsRender", "tabsRender",+ "genListItemElement", "disposeCustomBlocksInElement", "processRender", "highlightRender", "avRender", "blockRender",+ source + "; return {readListMindmap, retagMindmapBranch, writeListMindmapMetadata, copyMindmapBranches, " ++ "readMindmapClipboard, pasteMindmapBranches, canCutMindmapBranches, removeMindmapBranches, " ++ "ListMindmapView, ClipboardController};")(+ constants, async () => {}, (owner: {disabled?: boolean}) => !owner.disabled,+ (message: string) => messages.push(message), () => write(), () => read(),+ (html: string) => html, (html: string) => html, (): null => null, (): void => {}, (): void => {},+ () => {+ const template = document.createElement("template");+ template.innerHTML = Lute.New().Md2BlockDOM("- \n");+ return template.content.querySelector('[data-type="NodeListItem"]');+ }, (): void => {}, (): void => {}, (): void => {}, (): void => {}, (): void => {});+ const lute = Lute.New();+ lute.SetKramdownIAL(true);+ lute.SetProtyleWYSIWYG(true);+ window.siyuan = {languages: new Proxy({}, {get: (_, key) => String(key)}),+ config: {editor: {}}, storage: {}} as unknown as typeof window.siyuan;+ const style = document.createElement("style");+ style.textContent = css;+ document.head.append(style);+ const makeList = (native = true) => {+ const holder = document.createElement("div");+ holder.innerHTML = lute.Md2BlockDOM("- Root\n - Alpha **bold**\n - Child\n - Beta\n - Gamma\n");+ const list = holder.firstElementChild as HTMLElement;+ if (native) {+ api.retagMindmapBranch(list, true);+ } else {+ list.setAttribute(constants.CUSTOM_SY_LIST_MINDMAP, "1");+ }+ return list;+ };+ for (const native of [true, false]) {+ const list = makeList(native);+ const model = api.readListMindmap(list);+ const [a, b, c] = model.root.children;+ model.metadata.nodes[a.id] = {backgroundColor: "red"};+ model.metadata.relations = [+ {id: Lute.NewNodeID(), from: a.id, to: b.id, label: "Inside"},+ {id: Lute.NewNodeID(), from: a.id, to: c.id, label: "Outside"},+ ];+ model.metadata.summaries = [{id: Lute.NewNodeID(), parentId: model.root.id,+ nodeIds: [a.id, b.id], label: "Group"}];+ api.writeListMindmapMetadata(list, model.metadata);+ const before = list.outerHTML;+ const copied = api.copyMindmapBranches(list, [b.id, a.children[0].id, a.id]);+ check.equal(list.outerHTML, before);+ const payload = api.readMindmapClipboard(copied);+ const selected = api.readListMindmap(payload);+ check.deepEqual(selected.root.children.map((node: {id: string}) => node.id), [a.id, b.id],+ "copy follows source order and excludes duplicate descendants");+ check.equal(selected.nodes.size, 4);+ check.equal(selected.metadata.relations.length, 1);+ check.equal(selected.metadata.summaries[0].parentId, payload.dataset.nodeId);+ for (const placement of ["child", "after"]) {+ const pasted = api.pasteMindmapBranches(list, payload, c.id, placement, lute);+ check.ok(pasted);+ const next = api.readListMindmap(pasted.list);+ const oldIDs = new Set([list.dataset.nodeId, ...Array.from(list.querySelectorAll<HTMLElement>("[data-node-id]"))+ .map(node => node.dataset.nodeId)]);+ const newIDs = Array.from((pasted.list as HTMLElement).querySelectorAll<HTMLElement>("[data-node-id]"))+ .map(node => node.dataset.nodeId).filter(id => !oldIDs.has(id));+ check.equal(new Set(newIDs).size, newIDs.length);+ check.equal(next.nodes.get(pasted.ids[0]).children.length, 1);+ check.match(next.nodes.get(pasted.ids[0]).element.outerHTML, /bold/);+ check.equal(next.metadata.nodes[pasted.ids[0]].backgroundColor, "red");+ check.equal(next.metadata.relations.length, 3);+ const relation = next.metadata.relations[2];+ check.deepEqual([relation.from, relation.to], pasted.ids);+ check.notEqual(relation.id, selected.metadata.relations[0].id);+ const summary = next.metadata.summaries[1];+ check.deepEqual(summary.nodeIds, pasted.ids);+ check.equal(summary.parentId, placement === "child" ? c.id : model.root.id);+ check.equal(api.readListMindmap(api.readMindmapClipboard(lute.SpinBlockDOM(pasted.list.outerHTML)))+ .nodes.size, next.nodes.size, "Lute persistence keeps the complete pasted hierarchy");+ }+ const removed = api.removeMindmapBranches(list, [a.id, a.children[0].id, b.id]);+ check.ok(removed);+ check.deepEqual(api.readListMindmap(removed).root.children.map((node: {id: string}) => node.id), [c.id]);+ check.equal(list.outerHTML, before, "preparing cut/delete leaves the source intact");+ check.equal(api.canCutMindmapBranches(model, [model.root.id]), false);+ check.equal(api.removeMindmapBranches(list, [model.root.id]), false);+ check.equal(api.readMindmapClipboard('<div data-type="NodeParagraph">ordinary</div>'), undefined);+ check.throws(() => api.readMindmapClipboard(copied.replace('data-node-id="' + a.id, 'data-node-id="' + b.id)));+ }+ const virtual = document.createElement("div");+ virtual.innerHTML = lute.Md2BlockDOM("- A\n- B\n");+ const virtualList = virtual.firstElementChild as HTMLElement;+ api.retagMindmapBranch(virtualList, true);+ const virtualModel = api.readListMindmap(virtualList);+ virtualModel.metadata.rootTitle = "Named center";+ api.writeListMindmapMetadata(virtualList, virtualModel.metadata);+ check.equal(api.canCutMindmapBranches(virtualModel, virtualModel.root.children.map((node: {id: string}) => node.id)), false);+ const destination = makeList();+ const rootID = api.readListMindmap(destination).root.id;+ const virtualCopy = api.readMindmapClipboard(api.copyMindmapBranches(virtualList, [virtualModel.root.id]));+ const virtualPaste = api.pasteMindmapBranches(destination, virtualCopy, rootID, "child", lute);+ const pastedCenter = api.readListMindmap(virtualPaste.list).nodes.get(virtualPaste.ids[0]);+ check.match(pastedCenter.element.textContent, /Named center/);+ check.equal(pastedCenter.children.length, 2, "a named virtual center is preserved as a real parent");++ const list = makeList();+ document.body.append(list);+ const model = api.readListMindmap(list);+ const [a, b] = model.root.children;+ const host = document.createElement("div");+ host.className = "mindmap-view";+ host.style.cssText = "position:relative;width:850px;height:500px";+ document.body.append(host);+ const copied: {ids: string[], cut: boolean}[] = [];+ const pasted: {id: string, kind: string}[] = [];+ // Synthetic events have no native pointer capture; geometry and handlers still run in Chromium.+ const capture = HTMLElement.prototype.setPointerCapture;+ const hasCapture = HTMLElement.prototype.hasPointerCapture;+ HTMLElement.prototype.setPointerCapture = () => {};+ HTMLElement.prototype.hasPointerCapture = () => false;+ const view = new api.ListMindmapView({host, model, onExit() {},+ onCopy: (ids: string[], cut: boolean) => copied.push({ids, cut}),+ onPaste: (id: string, kind: string) => pasted.push({id, kind}),+ onClipboardMenu() {}, onDeleteNodes() {}});+ const wait = () => new Promise(resolve => setTimeout(resolve, 40));+ await wait();+ const pointer = (id: string, modifiers: PointerEventInit = {}) => {+ const node = view.nodeElements.get(id) as HTMLElement;+ const rect = node.getBoundingClientRect();+ node.dispatchEvent(new PointerEvent("pointerdown", {pointerId: 1, pointerType: "mouse", button: 0,+ bubbles: true, cancelable: true, clientX: rect.left + rect.width / 2,+ clientY: rect.top + rect.height / 2, ...modifiers}));+ view.viewport.dispatchEvent(new PointerEvent("pointerup", {pointerId: 1, bubbles: true}));+ };+ pointer(a.id);+ pointer(b.id, {ctrlKey: true});+ check.deepEqual(new Set(view.getSelectedIds()), new Set([a.id, b.id]));+ check.equal(host.querySelectorAll('[aria-selected="true"]').length, 2);+ host.dispatchEvent(new ClipboardEvent("copy", {bubbles: true, cancelable: true, clipboardData: new DataTransfer()}));+ check.deepEqual(new Set(copied[0].ids), new Set([a.id, b.id]));+ for (const key of ["c", "x"]) {+ const event = new KeyboardEvent("keydown", {key, ctrlKey: true, bubbles: true, cancelable: true});+ host.dispatchEvent(event);+ check.equal(event.defaultPrevented, true, "canvas shortcuts do not depend on a DOM text selection");+ }+ check.deepEqual(copied.slice(1).map(item => item.cut), [false, true]);+ pointer(a.id, {metaKey: true});+ check.deepEqual(view.getSelectedIds(), [b.id], "Command-click toggles membership too");+ host.querySelector<HTMLButtonElement>('[aria-label="multiSelect"]').click();+ pointer(a.id, {pointerType: "touch", isPrimary: true});+ check.equal(view.getSelectedIds().length, 2, "touch multi-selection shares the same selection");+ host.querySelector<HTMLButtonElement>('[aria-label="multiSelect"]').click();+ view.focusNode(a.id);+ const beforePan = [view.offsetX, view.offsetY];+ const viewport = view.viewport.getBoundingClientRect();+ const rects = [a.id, b.id].map(id => view.nodeElements.get(id).getBoundingClientRect());+ const left = Math.min(...rects.map(rect => rect.left)) - 4;+ const top = Math.min(...rects.map(rect => rect.top)) - 4;+ const right = Math.max(...rects.map(rect => rect.right)) + 4;+ const bottom = Math.max(...rects.map(rect => rect.bottom)) + 4;+ view.findLine = (): undefined => undefined;+ view.viewport.dispatchEvent(new PointerEvent("pointerdown", {pointerId: 3, pointerType: "mouse",+ button: 0, bubbles: true, clientX: left, clientY: top}));+ view.viewport.dispatchEvent(new PointerEvent("pointermove", {pointerId: 3, pointerType: "mouse",+ bubbles: true, clientX: right, clientY: bottom}));+ view.viewport.dispatchEvent(new PointerEvent("pointerup", {pointerId: 3, pointerType: "mouse",+ bubbles: true, clientX: right, clientY: bottom}));+ check.ok(view.getSelectedIds().includes(a.id) && view.getSelectedIds().includes(b.id));+ check.deepEqual([view.offsetX, view.offsetY], beforePan, "marquee selection does not pan");+ check.ok(viewport.width > 0);+ view.focusNode(a.id);+ const data = new DataTransfer();+ data.setData("text/plain", "Text");+ host.dispatchEvent(new ClipboardEvent("paste", {bubbles: true, cancelable: true, clipboardData: data}));+ host.dispatchEvent(new KeyboardEvent("keydown", {key: "V", ctrlKey: true, shiftKey: true,+ bubbles: true, cancelable: true}));+ check.deepEqual(pasted.map(item => item.kind), ["child", "sibling"]);+ view.setEditing(a.id);+ const count = pasted.length;+ host.dispatchEvent(new ClipboardEvent("paste", {bubbles: true, cancelable: true, clipboardData: data}));+ check.equal(pasted.length, count, "editing delegates text and image paste to the fragment editor");+ view.setEditing(undefined);+ view.setReadOnly(true);+ host.dispatchEvent(new ClipboardEvent("cut", {bubbles: true, cancelable: true, clipboardData: data}));+ check.equal(copied.length, 3, "read-only maps cannot cut nodes");+ view.destroy();+ HTMLElement.prototype.setPointerCapture = capture;+ HTMLElement.prototype.hasPointerCapture = hasCapture;+ host.remove();++ const controller = new api.ClipboardController();+ let transactionCount = 0;+ let selected = a.id;+ Object.assign(controller, {+ list, host: document.createElement("div"), model, owner: {lute, block: {rootID: "document"}, disabled: false},+ view: {getSelectedId: () => selected, getSelectedIds: () => [selected], focusNode: (id: string) => selected = id,+ getContentHost: () => controller.host},+ change: async (action: () => boolean | void) => {+ const before = list.outerHTML;+ if (action() === false) {+ return false;+ }+ if (list.outerHTML !== before) {+ transactionCount++;+ }+ controller.model = api.readListMindmap(list);+ return true;+ },+ });+ controller.host.className = "mindmap-view";+ list.append(controller.host);+ const before = list.outerHTML;+ write = async () => ({status: "failed"});+ await controller.copyNodes([a.id], true);+ check.equal(list.outerHTML, before);+ check.equal(transactionCount, 0);+ write = async () => ({status: "plain"});+ await controller.copyNodes([a.id], true);+ check.equal(list.outerHTML, before, "plain-only clipboard support never destroys a rich branch");+ let finishWrite: (value: {status: string}) => void;+ write = () => new Promise(resolve => finishWrite = resolve);+ const pending = controller.copyNodes([a.id], true);+ list.setAttribute("custom-concurrent", "change");+ finishWrite({status: "rich"});+ await pending;+ check.ok(api.readListMindmap(list).nodes.has(a.id), "a concurrent source change cancels deletion");+ write = async () => ({status: "rich"});+ await controller.copyNodes([a.id], true);+ check.equal(api.readListMindmap(list).nodes.has(a.id), false);+ check.equal(transactionCount, 1, "cut deletes the subtree in one transaction");+ selected = b.id;+ const clipboard = api.copyMindmapBranches(list, [b.id]);+ const fullscreenMarker = document.createComment("mindmap-view");+ controller.host.replaceWith(fullscreenMarker);+ document.body.append(controller.host);+ await controller.pasteNodes(b.id, "sibling", {siyuanHTML: clipboard});+ check.equal(transactionCount, 2, "hierarchy paste uses one transaction");+ check.notEqual(selected, b.id);+ check.equal(controller.host.parentElement, document.body, "full-screen paste preserves the canvas host");+ check.equal(fullscreenMarker.parentElement, list, "the full-screen return marker survives the transaction");+ let finishRead: (data: IClipboardData) => void;+ read = () => new Promise(resolve => finishRead = resolve);+ const pendingPaste = controller.pasteNodes(selected, "child");+ selected = rootID;+ finishRead({siyuanHTML: clipboard});+ await pendingPaste;+ check.equal(transactionCount, 2, "late clipboard reads cannot paste into a changed selection");+ const forwarded: {id: string, data: IClipboardData}[] = [];+ controller.edit = async (id: string, _host: HTMLElement, _text: string, data: IClipboardData) => {+ check.equal(_host, controller.host);+ check.equal(_text, undefined);+ check.equal(controller.model.nodes.get(id).parentId, b.id);+ forwarded.push({id, data});+ };+ for (const data of [{textPlain: "external text"}, {textHTML: "<p><strong>rich</strong></p>"},+ {siyuanHTML: lute.Md2BlockDOM("Internal **block**")},+ {files: [new File(["image"], "image.png", {type: "image/png"})]}]) {+ selected = b.id;+ await controller.pasteNodes(b.id, "child", data);+ check.equal(forwarded.at(-1)?.data, data, "external content reaches the new node's standard paste pipeline");+ }+ check.equal(forwarded.length, 4);+ check.equal(messages.length, 2);+ controller.host.remove();+ list.remove();+ return "mindmap-node-clipboard-ok";+};++test("mind map selection and clipboard preserve branches, metadata, identities and failed-cut safety", {timeout: 45000}, async () => {+ const compile = (file: string) => ts.transpileModule(readFileSync(path.resolve(__dirname, file), "utf8")+ .replace(/^import [\s\S]*?;\r?\n/gm, "").replace(/^export /gm, ""), {+ compilerOptions: {target: ts.ScriptTarget.ES2021},+ }).outputText;+ const sourceFile = ts.createSourceFile("index.ts", readFileSync(path.join(__dirname, "index.ts"), "utf8"),+ ts.ScriptTarget.Latest, true);+ const controller = sourceFile.statements.find(ts.isClassDeclaration);+ const methods = controller.members.filter(member =>+ ["copyNodes", "removeNodes", "replaceClipboardSource", "replaceSourceChildren", "pasteNodes", "add"]+ .includes(member.name?.getText(sourceFile)));+ const source = ["../../wysiwyg/listContext.ts", "summary.ts", "model.ts", "../../util/tabsCopy.ts", "clipboard.ts",+ "fold.ts", "routing.ts", "pan.ts", "connectors.ts", "../av/richTextValue.ts", "view.ts",+ "../../util/blockDOMClipboard.ts", "../../util/clipboardData.ts"].map(compile).join("\n") ++ ts.transpileModule(`class ClipboardController {${methods.map(method => method.getText(sourceFile)).join("\n")}}`,+ {compilerOptions: {target: ts.ScriptTarget.ES2021}}).outputText;+ const css = require("sass").compile(path.resolve(__dirname, "../../../assets/scss/protyle/_mindmap-view.scss")).css;+ const dir = mkdtempSync(path.join(tmpdir(), "siyuan-mindmap-clipboard-"));+ const script = path.join(dir, "run.cjs");+ const browser = ts.transpileModule(`(${browserCases.toString()})`, {compilerOptions: {target: ts.ScriptTarget.ES2021}})+ .outputText.trim().replace(/^"use strict";\s*/, "").replace(/;$/, "");+ writeFileSync(script, `+const {app, BrowserWindow} = require("electron");+app.setPath("userData", ${JSON.stringify(path.join(dir, "profile"))});+app.commandLine.appendSwitch("disable-gpu");+app.whenReady().then(async () => {+ const win = new BrowserWindow({show:false, webPreferences:{nodeIntegration:true,contextIsolation:false}});+ win.webContents.on("console-message", event => console.error(event.message));+ try {+ await win.loadURL("data:text/html,<html><body></body></html>");+ await win.webContents.executeJavaScript(require("fs").readFileSync(${JSON.stringify(path.resolve("stage/protyle/js/lute/lute.min.js"))}, "utf8"));+ console.log(await win.webContents.executeJavaScript(${JSON.stringify(+ `const __name = value => value; (${browser})(${JSON.stringify(source)}, ${JSON.stringify(css)})`)}));+ win.destroy(); app.exit(0);+ } catch (error) {console.error(error); win.destroy(); app.exit(1);}+});`, "utf8");+ const env = {...process.env};+ delete env.ELECTRON_RUN_AS_NODE;+ try {+ const result = await promisify(execFile)(require("electron") as string, [script],+ {env, windowsHide: true, timeout: 40000});+ assert.match(result.stdout, /mindmap-node-clipboard-ok/);+ } finally {+ rmSync(dir, {recursive: true, force: true});+ }+});diff --git a/app/src/protyle/render/listMindmap/clipboard.ts b/app/src/protyle/render/listMindmap/clipboard.tsnew file mode 100644index 0000000000..84c3729d16--- /dev/null+++ b/app/src/protyle/render/listMindmap/clipboard.ts@@ -0,0 +1,156 @@+import {Constants} from "../../../constants";+import {remapTabsDOMIDs} from "../../util/tabsCopy";+import {+ addListMindmapNode, cleanListMindmapHTML, deleteListMindmapNode, materializeListMindmapRoot,+ readListMindmap, remapListMindmapIDs, retagMindmapBranch, writeListMindmapMetadata,+} from "./model";+import type {ListMindmapModel, ListMindmapPlacement} from "./model";+import {getListMindmapSiblingIDs} from "./summary";++// 按源文档顺序复制最外层分支,父子同时选中时只复制一次。+export const getMindmapSelectedRoots = (model: ListMindmapModel, ids: string[]) => {+ const selected = new Set(ids);+ if (model.root.virtual && selected.has(model.root.id)) {+ return model.root.children;+ }+ const result: typeof model.root[] = [];+ const pending = [model.root];+ while (pending.length) {+ const node = pending.pop();+ if (!node.virtual && selected.has(node.id)) {+ result.push(node);+ } else {+ pending.push(...node.children.slice().reverse());+ }+ }+ return result;+};++const cloneSource = (list: HTMLElement) => {+ const template = document.createElement("template");+ template.innerHTML = cleanListMindmapHTML(list.outerHTML);+ return template.content.firstElementChild as HTMLElement;+};++export const copyMindmapBranches = (list: HTMLElement, ids: string[]) => {+ const model = readListMindmap(list);+ const roots = getMindmapSelectedRoots(model, ids);+ if (!roots.length) {+ return "";+ }+ const copy = list.cloneNode(false) as HTMLElement;+ copy.removeAttribute("data-mindmap-view-rendered");+ copy.replaceChildren(...roots.map(node => cloneSource(node.element)));+ const copied = readListMindmap(copy);+ const included = new Set(copied.nodes.keys());+ const top = new Set(roots.map(node => node.id));+ const metadata = {...model.metadata,+ nodes: Object.fromEntries(Object.entries(model.metadata.nodes).filter(([id]) => included.has(id))),+ relations: model.metadata.relations.filter(item => included.has(item.from) && included.has(item.to)),+ summaries: model.metadata.summaries?.filter(item => item.nodeIds.every(id => included.has(id)))+ .map(item => ({...item, parentId: top.has(item.nodeIds[0]) ? copy.dataset.nodeId : item.parentId})),+ };+ if (!model.root.virtual || !ids.includes(model.root.id)) {+ delete metadata.rootTitle;+ }+ writeListMindmapMetadata(copy, metadata);+ return cleanListMindmapHTML(copy.outerHTML);+};++export const canCutMindmapBranches = (model: ListMindmapModel, ids: string[]) => {+ if (ids.includes(model.root.id)) {+ return false;+ }+ const roots = getMindmapSelectedRoots(model, ids);+ // 始终保留根节点;多顶层分支的导图也不能通过一次剪切变为空块。+ return roots.length > 0 && (!model.root.virtual ||+ model.root.children.some(child => !roots.some(root => root.id === child.id)));+};++export const removeMindmapBranches = (list: HTMLElement, ids: string[]) => {+ const model = readListMindmap(list);+ if (!canCutMindmapBranches(model, ids)) {+ return false;+ }+ const copy = cloneSource(list);+ for (const node of getMindmapSelectedRoots(model, ids)) {+ if (!deleteListMindmapNode(copy, node.id)) {+ return false;+ }+ }+ return copy;+};++// 仅接管完整导图载荷。普通块、网页和图片继续使用节点编辑器的标准粘贴管线。+export const readMindmapClipboard = (html: string) => {+ const template = document.createElement("template");+ template.innerHTML = cleanListMindmapHTML(Lute.Sanitize(html));+ const list = template.content.firstElementChild as HTMLElement;+ if (template.content.children.length !== 1 || !list ||+ list.dataset.type !== "NodeMindmap" &&+ !(list.dataset.type === "NodeList" && list.getAttribute(Constants.CUSTOM_SY_LIST_MINDMAP) === "1")) {+ return;+ }+ readListMindmap(list);+ return list;+};++export const pasteMindmapBranches = (list: HTMLElement, source: HTMLElement, targetId: string,+ placement: ListMindmapPlacement, lute: Lute) => {+ const copy = cloneSource(list);+ const incoming = cloneSource(source);+ // 虚拟根实体化沿用列表转换器,再统一转回目标导图的容器类型。+ retagMindmapBranch(incoming, false);+ materializeListMindmapRoot(incoming, lute);+ const ids = new Map<string, string>();+ [incoming, ...incoming.querySelectorAll<HTMLElement>("[data-node-id]")].forEach(block => {+ const id = block.dataset.nodeId;+ if (!id || ids.has(id)) {+ throw new Error("Invalid copied mindmap identity");+ }+ const next = Lute.NewNodeID();+ ids.set(id, next);+ block.dataset.nodeId = next;+ block.setAttribute("updated", next.substring(0, 14));+ });+ remapTabsDOMIDs(incoming, ids);+ remapListMindmapIDs(incoming, ids);+ retagMindmapBranch(incoming, list.dataset.type === "NodeMindmap");+ const sourceModel = readListMindmap(incoming);+ const roots = sourceModel.root.virtual ? sourceModel.root.children : [sourceModel.root];+ const inserted: string[] = [];+ let target = targetId;+ for (const node of roots) {+ if (!addListMindmapNode(copy, target, placement, node.element)) {+ return;+ }+ inserted.push(node.id);+ if (placement === "after") {+ target = node.id;+ }+ }+ if (!inserted.length) {+ return;+ }+ const model = readListMindmap(copy);+ const metadata = model.metadata;+ Object.assign(metadata.nodes, sourceModel.metadata.nodes);+ delete metadata.nodes[incoming.dataset.nodeId];+ metadata.relations.push(...sourceModel.metadata.relations.map(relation => {+ const copied = {...relation, id: Lute.NewNodeID()};+ delete copied.route;+ return copied;+ }));+ const parents = getListMindmapSiblingIDs(model);+ const parentId = [...parents].find(([, children]) => children.includes(inserted[0]))?.[0];+ const summaries = sourceModel.metadata.summaries?.map(summary => ({...summary,+ id: Lute.NewNodeID(),+ parentId: summary.parentId === incoming.dataset.nodeId ? parentId : summary.parentId,+ })).filter(summary => parents.get(summary.parentId)?.includes(summary.nodeIds[0]));+ if (summaries?.length) {+ metadata.version = Math.max(metadata.version, sourceModel.metadata.version) as 1 | 2;+ metadata.summaries = [...(metadata.summaries || []), ...summaries];+ }+ writeListMindmapMetadata(copy, metadata);+ return {list: copy, ids: inserted};+};diff --git a/app/src/protyle/render/listMindmap/editor.test.ts b/app/src/protyle/render/listMindmap/editor.test.tsindex 15afe947e4..188e45483c 100644--- a/app/src/protyle/render/listMindmap/editor.test.ts+++ b/app/src/protyle/render/listMindmap/editor.test.ts@@ -139,13 +139,12 @@ const browserCases = async (sourceCode: string, css: string, cleanupSource: stri};},bindLiteCodeActions: noop,- uploadFiles: (target: typeof protyle, files: File[], _element: unknown, _success: unknown,- _complete: unknown, options: {source: string}) => {+ paste: (target: typeof protyle, data: {files?: File[], target: HTMLElement}) => {check.equal(target, protyle);- check.equal(options.source, "paste");+ check.equal(data.target, wysiwyg);check.equal(target.block.rootID, rootID);check.equal(target.toolbar.range, undefined);- state.uploads.push(files);+ state.uploads.push(data.files);},setMobileToolbarUndo: noop,getDefaultToolbar: (): unknown[] => [],@@ -315,7 +314,7 @@ const browserCases = async (sourceCode: string, css: string, cleanupSource: striconst imageEditor = create(paragraph("body", "Keep text"));const images = [new File(["image"], "image.png", {type: "image/png"})];- imageEditor.editor.pasteImages(images);+ imageEditor.editor.pasteClipboard({files: images});check.equal(imageEditor.state.focusedText, "Keep text");check.deepEqual(imageEditor.state.uploads, [images]);check.equal(imageEditor.wysiwyg.textContent, "Keep text");@@ -328,7 +327,7 @@ const browserCases = async (sourceCode: string, css: string, cleanupSource: striimageEditor.protyle.upload.isUploading = false;check.equal(await imageEditor.editor.finish(), true);check.equal(imageEditor.element.querySelector("img").getAttribute("src"), "assets/image.png");- imageEditor.editor.pasteImages(images);+ imageEditor.editor.pasteClipboard({files: images});check.equal(imageEditor.state.uploads.length, 1, "closed editors do not accept another upload");await imageEditor.remove();for (const resized of [false, true]) {diff --git a/app/src/protyle/render/listMindmap/editor.ts b/app/src/protyle/render/listMindmap/editor.tsindex 9264914c78..42e88aa307 100644--- a/app/src/protyle/render/listMindmap/editor.ts+++ b/app/src/protyle/render/listMindmap/editor.ts@@ -11,7 +11,7 @@ import {bindLiteCodeActions} from "../../lite/codeActions";import {setMobileToolbarUndo} from "../../lite/mobileToolbar";import {getDefaultToolbar} from "../../toolbar/defaults";import {hideElements} from "../../ui/hideElements";-import {uploadFiles} from "../../upload";+import {paste} from "../../util/paste";import {matchHotKey} from "../../util/hotKey";import {processRender} from "../../util/processCode";import {initEditorTabs} from "../../wysiwyg/tabs";@@ -534,12 +534,12 @@ export const openListMindmapEditor = (options: ListMindmapEditorOptions) => {getSelection().setBaseAndExtent(range.endContainer, range.endOffset, range.startContainer, range.startOffset);}undoSelection ||= captureSelection();- return {finish, destroy, pasteImages: (files: File[]) => {+ return {finish, destroy, pasteClipboard: (data: IClipboardData) => {if (finished || closing || !options.canEdit()) {return;}fragment.focus(true);fragment.protyle.toolbar.range = undefined;- uploadFiles(fragment.protyle, files, undefined, undefined, undefined, {source: "paste"});+ return paste(fragment.protyle, {...data, target: fragment.wysiwyg});}};};diff --git a/app/src/protyle/render/listMindmap/index.ts b/app/src/protyle/render/listMindmap/index.tsindex 855c826240..3cc5edd806 100644--- a/app/src/protyle/render/listMindmap/index.ts+++ b/app/src/protyle/render/listMindmap/index.ts@@ -59,6 +59,12 @@ import {getListMindmapConnectorMenuItem} from "./connectorMenu";import {getDefaultListMindmapConnectorStyle, setDefaultListMindmapConnectorStyle} from "./preferences";import {getEmbedChildOperationContext} from "../../wysiwyg/getBlock";import {requestRedo, requestUndo} from "../../undo/globalUndo";+import {buildBlockDOMClipboardData} from "../../util/blockDOMClipboard";+import {buildWebClipboardHTML, getTextSiyuanFromTextHTML} from "../../util/clipboardData";+import {readClipboard, writeClipboardData} from "../../util/compatibility";+import {prepareExternalClipboardHTML} from "../../util/richClipboard";+import {canCutMindmapBranches, copyMindmapBranches, pasteMindmapBranches, readMindmapClipboard,+ removeMindmapBranches} from "./clipboard";const roots = new WeakMap<IProtyle, {refresh: () => void, mountNew: (list: HTMLElement) => void,restoreFocus: (listID: string, candidateIDs: string[], selection?: Record<string, string>, source?: HTMLElement) => void, focusRevision: number,@@ -368,7 +374,30 @@ class ListMindmapController {}},onEdit: (id, contentHost, replaceFirstParagraph) => this.edit(id, contentHost, replaceFirstParagraph),- onPasteImages: (id, files) => void this.edit(id, this.view.getContentHost(id), undefined, files),+ onCopy: (ids, cut, event) => void this.copyNodes(ids, cut, event),+ onPaste: (id, kind, data) => void this.pasteNodes(id, kind, data),+ onDeleteNodes: ids => void this.removeNodes(ids),+ onClipboardMenu: (anchor, ids) => {+ toggleMenu({target: anchor, build: (_menu, session) => {+ const menu = new Menu();+ menu.addItem({label: window.siyuan.languages.copy, icon: "iconCopy",+ click: () => void this.copyNodes(ids, false)});+ if (canEdit(owner, list) && canCutMindmapBranches(readListMindmap(list), ids)) {+ menu.addItem({label: window.siyuan.languages.cut, icon: "iconCut",+ click: () => void this.copyNodes(ids, true)});+ }+ if (ids.length === 1 && canEdit(owner, list)) {+ menu.addItem({label: window.siyuan.languages.mindmapPasteChild, icon: "iconPaste",+ click: () => void this.pasteNodes(ids[0], "child")});+ if (!this.model.nodes.get(ids[0])?.virtual) {+ menu.addItem({label: window.siyuan.languages.mindmapPasteSibling, icon: "iconPaste",+ click: () => void this.pasteNodes(ids[0], "sibling")});+ }+ }+ const rect = anchor.getBoundingClientRect();+ session.show(() => menu.open({x: rect.left, y: rect.bottom, h: rect.height}));+ }});+ },isAddSiblingShortcut: event => {const key = window.siyuan.config.keymap.editor.list?.mindmapAddSibling;return !!key && matchHotKey(key, event);@@ -680,7 +709,117 @@ class ListMindmapController {}}- private async add(id: string, kind: "child" | "sibling") {+ private async copyNodes(ids: string[], cut: boolean, event?: ClipboardEvent) {+ try {+ if (this.disposed || !this.list.isConnected || this.activeEditor ||+ cut && (!canEdit(this.owner, this.list) || !canCutMindmapBranches(this.model, ids))) {+ return;+ }+ const before = cleanListMindmapHTML(this.list.outerHTML);+ const source = copyMindmapBranches(this.list, ids);+ if (!source) {+ return;+ }+ const data = buildBlockDOMClipboardData(this.owner.lute, source);+ data.textHTML = prepareExternalClipboardHTML(data.textHTML);+ if (event?.clipboardData) {+ event.clipboardData.setData("text/plain", data.textPlain);+ event.clipboardData.setData("text/html", buildWebClipboardHTML(data.textHTML, data.textSiyuan));+ event.clipboardData.setData("text/siyuan", data.textSiyuan);+ return;+ }+ const result = await writeClipboardData(data, {fallbackToPlainText: !cut});+ if (result.status === "failed" || cut && result.status !== "rich") {+ showMessage(window.siyuan.languages.clipboardPermissionDenied);+ return;+ }+ if (cut && cleanListMindmapHTML(this.list.outerHTML) === before) {+ await this.removeNodes(ids, before);+ }+ } catch (error) {+ console.error(error);+ showMessage(window.siyuan.languages.listMindmapInvalid);+ }+ }++ private async removeNodes(ids: string[], expected?: string) {+ return this.change(() => {+ if (expected !== undefined && cleanListMindmapHTML(this.list.outerHTML) !== expected) {+ return false;+ }+ const copy = removeMindmapBranches(this.list, ids);+ if (!copy) {+ return false;+ }+ this.replaceClipboardSource(copy);+ });+ }++ private replaceClipboardSource(source: HTMLElement) {+ this.replaceSourceChildren(source);+ const metadata = source.getAttribute(Constants.CUSTOM_SY_LIST_MINDMAP_DATA);+ if (metadata !== null) {+ this.list.setAttribute(Constants.CUSTOM_SY_LIST_MINDMAP_DATA, metadata);+ }+ }++ private replaceSourceChildren(source: HTMLElement) {+ // 全屏时画布位于 body,保留原位置标记,退出全屏时仍能还原。+ const retained = Array.from(this.list.childNodes).filter(child => child === this.host ||+ child.nodeType === Node.COMMENT_NODE && child.nodeValue === "mindmap-view");+ Array.from(this.list.childNodes).forEach(child => {+ if (!retained.includes(child)) {+ if (child instanceof Element) {+ disposeCustomBlocksInElement(child);+ }+ child.remove();+ }+ });+ const children = Array.from(source.childNodes);+ children.forEach(child => this.list.insertBefore(child, retained[0] || null));+ children.forEach(child => {+ if (child instanceof Element) {+ processRender(child);+ highlightRender(child);+ avRender(child, this.owner);+ blockRender(this.owner, child);+ }+ });+ }++ private async pasteNodes(id: string, kind: "child" | "sibling", data?: IClipboardData) {+ const rootID = this.owner.block.rootID;+ const before = cleanListMindmapHTML(this.list.outerHTML);+ const current = () => !this.disposed && canEdit(this.owner, this.list) &&+ this.owner.block.rootID === rootID && this.view.getSelectedId() === id &&+ this.view.getSelectedIds().length === 1 && cleanListMindmapHTML(this.list.outerHTML) === before;+ try {+ data ||= await readClipboard();+ if (!current() || !data) {+ return;+ }+ const html = data.siyuanHTML || getTextSiyuanFromTextHTML(data.textHTML || "").textSiyuan;+ const source = html && readMindmapClipboard(html);+ if (source) {+ const result = pasteMindmapBranches(this.list, source, id, kind === "child" ? "child" : "after", this.owner.lute);+ if (result && await this.change(() => {+ if (!current()) {+ return false;+ }+ this.replaceClipboardSource(result.list);+ }, false, result.ids[0])) {+ this.view.focusNode(result.ids[0]);+ }+ } else if (data.textPlain || data.textHTML || data.siyuanHTML || data.files?.length || data.localFiles?.length) {+ await this.add(id, kind, data);+ }+ } catch (error) {+ console.error(error);+ showMessage(window.siyuan.languages.listMindmapInvalid);+ }+ }++ private async add(id: string, kind: "child" | "sibling", clipboard?: IClipboardData) {if (!canEdit(this.owner, this.list)) {return;}@@ -703,11 +842,11 @@ class ListMindmapController {this.view.focusNode(item.dataset.nodeId);const content = this.view.getContentHost(item.dataset.nodeId);if (content) {- void this.edit(item.dataset.nodeId, content);+ await this.edit(item.dataset.nodeId, content, undefined, clipboard);}}- private async edit(id: string, host: HTMLElement, replaceFirstParagraph?: string, images?: File[],+ private async edit(id: string, host: HTMLElement, replaceFirstParagraph?: string, clipboard?: IClipboardData,selection?: Record<string, string>, guard?: () => boolean) {if (guard && !guard()) {return;@@ -749,8 +888,8 @@ class ListMindmapController {if (!this.activeEditor) {this.view.setEditing(undefined);this.view.update(this.model);- } else if (images) {- this.activeEditor.pasteImages(images);+ } else if (clipboard) {+ await this.activeEditor.pasteClipboard(clipboard);}}@@ -857,27 +996,7 @@ class ListMindmapController {Array.from(this.list.attributes).forEach(attribute => this.list.removeAttribute(attribute.name));Array.from(next.attributes).forEach(attribute => this.list.setAttribute(attribute.name, attribute.value));this.list.dataset.mindmapViewRendered = "true";- // 全屏时画布位于 body,原位置的标记也必须保留,才能正常退出全屏。- const retained = Array.from(this.list.childNodes).filter(child => child === this.host ||- child.nodeType === Node.COMMENT_NODE && child.nodeValue === "mindmap-view");- Array.from(this.list.childNodes).forEach(child => {- if (!retained.includes(child)) {- if (child instanceof Element) {- disposeCustomBlocksInElement(child);- }- child.remove();- }- });- const children = Array.from(next.childNodes);- children.forEach(child => this.list.insertBefore(child, retained[0] || null));- children.forEach(child => {- if (child instanceof Element) {- processRender(child);- highlightRender(child);- avRender(child, this.owner);- blockRender(this.owner, child);- }- });+ this.replaceSourceChildren(next);// 即使序列化正文相同,源 Element 已替换,模型也必须重新绑定新节点。this.snapshot = "";this.refresh();diff --git a/app/src/protyle/render/listMindmap/paste.test.ts b/app/src/protyle/render/listMindmap/paste.test.tsindex b72a874889..1e6977668f 100644--- a/app/src/protyle/render/listMindmap/paste.test.ts+++ b/app/src/protyle/render/listMindmap/paste.test.ts@@ -8,7 +8,7 @@ const source = createSourceFile("view.ts", readFileSync("src/protyle/render/listScriptTarget.ES2021, true);const view = source.statements.find(item => isClassDeclaration(item) && item.name?.text === "ListMindmapView");assert.ok(view && isClassDeclaration(view));-const handler = view.members.find(item => item.name?.getText(source) === "pasteImages");+const handler = view.members.find(item => item.name?.getText(source) === "pasteSelection");assert.ok(handler);const compiled = transpileModule(`class View { ${handler.getText(source)} }globalThis.View = View;`, {compilerOptions: {target: ScriptTarget.ES2021}}).outputText;@@ -16,36 +16,39 @@ globalThis.View = View;`, {compilerOptions: {target: ScriptTarget.ES2021}}).outpconst create = () => {const context: any = {};runInNewContext(compiled, context);- const calls: {id: string, files: unknown[]}[] = [];+ const calls: {id: string, kind: string, data: {files: unknown[], textPlain: string}}[] = [];const images = [{name: "image.png", type: "image/png"}, {name: "photo.jpg", type: "image/jpeg"}];let finish: () => void;const target = Object.assign(new context.View(), {readOnly: false, selectedId: "node",model: {nodes: new Map([["node", {virtual: false}]])},- options: {onPasteImages: (id: string, files: unknown[]) => calls.push({id, files})},+ getSelectedIds() { return this.selectedId ? [this.selectedId] : []; },+ options: {onPaste: (id: string, kind: string, data: {files: unknown[], textPlain: string}) => calls.push({id, kind, data})},finishThen: (action: () => void) => { finish = action; },});const event = {defaultPrevented: false,target: {isContentEditable: false, closest: (): object | null => null},- clipboardData: {files: [...images, {name: "file.pdf", type: "application/pdf"}]},+ clipboardData: {files: [...images, {name: "file.pdf", type: "application/pdf"}],+ getData: (type: string) => ({"text/plain": "", "text/html": "", "text/siyuan": ""}[type] || "")},preventDefault() { this.defaultPrevented = true; },};return {target, event, calls, images, finish: () => finish?.()};};-test("selected mind map nodes accept clipboard images after finishing the previous editor", () => {+test("selected mind map nodes paste all clipboard files into a new child after finishing the previous editor", () => {const current = create();- current.target.pasteImages(current.event);+ current.target.pasteSelection(current.event);assert.equal(current.event.defaultPrevented, true);assert.equal(current.calls.length, 0);current.finish();assert.equal(current.calls[0].id, "node");- assert.deepEqual(Array.from(current.calls[0].files), current.images);+ assert.equal(current.calls[0].kind, "child");+ assert.deepEqual(Array.from(current.calls[0].data.files), current.event.clipboardData.files);});-test("mind map image paste respects edit state, selection and read-only boundaries", () => {- for (const mode of ["readonly", "editing", "relation", "summary", "batch", "virtual", "missing", "unselected",+test("mind map paste respects edit state, selection and read-only boundaries", () => {+ for (const mode of ["readonly", "editing", "relation", "summary", "batch", "multiple", "missing", "unselected","input", "editable", "handled", "text", "export"]) {const current = create();switch (mode) {@@ -54,26 +57,26 @@ test("mind map image paste respects edit state, selection and read-only boundaricase "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 "virtual": current.target.model.nodes.get("node").virtual = 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;case "input": current.event.target.closest = () => ({}); break;case "editable": current.event.target.isContentEditable = true; break;case "handled": current.event.defaultPrevented = true; break;case "text": current.event.clipboardData.files = []; break;- case "export": current.target.options.onPasteImages = undefined; break;+ case "export": current.target.options.onPaste = undefined; break;}- current.target.pasteImages(current.event);+ current.target.pasteSelection(current.event);current.finish();assert.equal(current.calls.length, 0, mode);assert.equal(current.event.defaultPrevented, mode === "handled", mode);}});-test("delayed image paste never follows a changed selection or deleted node", () => {+test("delayed node paste never follows a changed selection or deleted node", () => {for (const change of ["selection", "delete", "readonly"]) {const current = create();- current.target.pasteImages(current.event);+ current.target.pasteSelection(current.event);if (change === "selection") {current.target.selectedId = "other";} else if (change === "delete") {@@ -85,3 +88,22 @@ test("delayed image paste never follows a changed selection or deleted node", ()assert.equal(current.calls.length, 0, change);}});++test("plain text and virtual-root child paste are supported, while sibling paste requires a real node", () => {+ for (const virtual of [false, true]) {+ for (const sibling of [false, true]) {+ const current = create();+ current.event.clipboardData.files = [];+ current.event.clipboardData.getData = type => type === "text/plain" ? "Copied text" : "";+ current.target.model.nodes.get("node").virtual = virtual;+ current.target.pasteSibling = sibling;+ current.target.pasteSelection(current.event);+ current.finish();+ assert.equal(current.calls.length, virtual && sibling ? 0 : 1);+ if (current.calls.length) {+ assert.equal(current.calls[0].data.textPlain, "Copied text");+ assert.equal(current.calls[0].kind, sibling ? "sibling" : "child");+ }+ }+ }+});diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 8658996451..b93bf0279a 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -43,7 +43,10 @@ export interface ListMindmapViewOptions {onFullscreen?: (enter: boolean, button: HTMLButtonElement) => void;onInteractionStart?: (event: PointerEvent) => () => void;onEdit?: (id: string, contentHost: HTMLElement, replaceFirstParagraph?: string) => void;- onPasteImages?: (id: string, files: File[]) => void;+ onCopy?: (ids: string[], cut: boolean, event?: ClipboardEvent) => void;+ onPaste?: (id: string, kind: "child" | "sibling", data?: IClipboardData) => void;+ onClipboardMenu?: (anchor: HTMLElement, ids: string[]) => void;+ onDeleteNodes?: (ids: string[]) => void;isAddSiblingShortcut?: (event: KeyboardEvent) => boolean;isAddChildShortcut?: (event: KeyboardEvent) => boolean;onRootTitleChange?: (title: string) => void;@@ -80,6 +83,7 @@ interface PointerState {rightButton?: boolean;pan?: boolean;id?: string;+ nodeId?: string;startX: number;startY: number;x: number;@@ -87,6 +91,7 @@ interface PointerState {moved: boolean;hiddenControls?: HTMLElement[];summary?: boolean;+ selection?: string[];targetId?: string;placement?: "before" | "child" | "after";relation?: {@@ -151,6 +156,9 @@ export class ListMindmapView {private edges: {from: string, to: string}[] = [];private bounds = {width: 1, height: 1};private selectedId?: string;+ private readonly selectedIds = new Set<string>();+ private multiSelect = false;+ private pasteSibling = false;private selectedRelation?: string;private selectedEdge?: string;private hoveredLine?: string;@@ -303,7 +311,10 @@ export class ListMindmapView {this.listen(this.viewport, "wheel", this.wheel, {passive: false});this.listen(this.viewport, "dragstart", (event: Event) => event.preventDefault());this.listen(options.host, "keydown", this.keyDown);- this.listen(options.host, "paste", this.pasteImages);+ this.listen(options.host, "copy", this.copySelection);+ this.listen(options.host, "cut", this.copySelection);+ this.listen(options.host, "paste", this.pasteSelection);+ this.listen(options.host, "keyup", () => this.pasteSibling = false);// 脑图内部先处理交互,再阻止外层文档将节点操作识别为列表块编辑。["pointerdown", "pointerup", "pointermove", "pointercancel", "mousedown", "mouseup", "mousemove", "click","dblclick", "contextmenu", "dragstart", "dragover", "drop", "beforeinput", "input", "compositionstart",@@ -428,6 +439,9 @@ export class ListMindmapView {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;+ }if (target instanceof Element && target.closest(".mindmap-view__relation-editor, .mindmap-view__route-handle, .mindmap-view__summary-editor")) {return;}@@ -703,13 +717,18 @@ export class ListMindmapView {}public update(model: ListMindmapModel) {- if (this.pointer?.relation || this.pointer?.summary) {+ if (this.pointer?.relation || this.pointer?.summary || this.pointer?.selection) {this.cancelPointer();}if (this.destroyed) {return;}this.model = model;+ this.selectedIds.forEach(id => {+ if (!model.nodes.has(id)) {+ this.selectedIds.delete(id);+ }+ });if (!!model.metadata.viewLocked !== this.persistedLocked) {this.persistedLocked = !!model.metadata.viewLocked;this.setLocked(this.persistedLocked);@@ -1031,6 +1050,11 @@ export class ListMindmapView {return this.selectedId;}+ public getSelectedIds() {+ return this.selectedId ? [...new Set([this.selectedId, ...this.selectedIds])]+ .filter(id => this.model.nodes.has(id)) : [];+ }+public focusNode(id: string) {if (this.destroyed || !this.model.nodes.has(id)) {return;@@ -2040,9 +2064,18 @@ export class ListMindmapView {}}- private selectNode(id: string) {+ private selectNode(id: string, additive = false) {const changed = this.selectedId !== id || !!this.selectedRelation;- this.selectedId = id;+ const ids = additive ? new Set(this.getSelectedIds()) : new Set<string>();+ if (additive && ids.has(id)) {+ ids.delete(id);+ this.selectedId = [...ids].pop();+ } else {+ ids.add(id);+ this.selectedId = id;+ }+ this.selectedIds.clear();+ ids.forEach(selected => this.selectedIds.add(selected));this.selectedSummary = undefined;this.selectedRelation = undefined;this.selectedEdge = undefined;@@ -2056,11 +2089,14 @@ export class ListMindmapView {}private updateSelection() {+ if (!this.selectedId) {+ this.selectedIds.clear();+ }if (!this.relationFrom) {this.relationPreview = undefined;}this.nodeElements.forEach((element, id) => {- const selected = this.selectedId === id || this.summarySelected.has(id);+ const selected = this.selectedId === id || this.selectedIds.has(id) || this.summarySelected.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 &&@@ -2070,7 +2106,7 @@ export class ListMindmapView {this.relationElements.forEach((element, id) => element.classList.toggle("mindmap-view__relation--selected", this.selectedRelation === id));const node = this.model.nodes.get(this.selectedId);const disabled: Record<string, boolean> = {- relation: !node || node.virtual,+ relation: !node || node.virtual || this.getSelectedIds().length > 1,summary: false,style: !node && !this.selectedRelation && !this.selectedEdge,};@@ -2175,6 +2211,8 @@ export class ListMindmapView {this.options.onSummaryDelete?.(this.selectedSummary);} else if (this.selectedRelation) {this.options.onRelationDelete?.(this.selectedRelation);+ } else if (this.getSelectedIds().length > 1 && this.options.onDeleteNodes) {+ this.options.onDeleteNodes(this.getSelectedIds());} else {const node = this.model.nodes.get(this.selectedId);if (node && !node.virtual && node !== this.model.root) {@@ -2376,7 +2414,13 @@ export class ListMindmapView {return;}if (id) {- this.selectNode(id);+ this.selectNode(id, event.button === 0 && (event.ctrlKey || event.metaKey || this.multiSelect));+ if (event.ctrlKey || event.metaKey || this.multiSelect) {+ this.suppressLinkClick = true;+ this.options.host.focus({preventScroll: true});+ this.cancelPointer();+ return;+ }}if ((!this.editingId || id) && !this.isTemporaryPan(event)) {this.options.host.focus({preventScroll: true});@@ -2391,12 +2435,15 @@ export class ListMindmapView {rightButton: event.button === 2,pan: this.panning || event.button === 2 || event.pointerType === "touch",id: !this.readOnly && id && !this.model.nodes.get(id)?.virtual ? id : undefined,+ nodeId: id,startX: event.clientX,startY: event.clientY,x: this.offsetX,y: this.offsetY,moved: false,hiddenControls,+ selection: !id && event.button === 0 && !this.panning && !this.relationFrom &&+ event.pointerType !== "touch" ? (event.ctrlKey || event.metaKey ? this.getSelectedIds() : []) : undefined,};try {// 在原点击元素捕获指针,保留链接目标,同时让连续点击可以识别为双击。@@ -2450,6 +2497,33 @@ export class ListMindmapView {pointer.hiddenControls?.forEach(element => element.classList.add("mindmap-view__node--hide-controls"));}pointer.moved = true;+ if (pointer.selection) {+ 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.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));+ this.nodeElements.forEach((element, id) => {+ if (!this.positions.has(id) || this.model.nodes.get(id)?.virtual) {+ return;+ }+ const rect = element.getBoundingClientRect();+ if (rect.left + rect.width / 2 >= left && rect.left + rect.width / 2 <= right &&+ rect.top + rect.height / 2 >= top && rect.top + rect.height / 2 <= bottom) {+ this.selectedIds.add(id);+ }+ });+ this.selectedId = [...this.selectedIds][0];+ this.selectedRelation = this.selectedEdge = this.selectedSummary = undefined;+ this.inspector.hidden = true;+ this.updateSelection();+ return;+ }if (pointer.summary) {const viewport = this.viewport.getBoundingClientRect();const left = Math.min(pointer.startX, event.clientX);@@ -2591,6 +2665,13 @@ export class ListMindmapView {return;}const {id, targetId, placement, moved} = pointer;+ if (pointer.selection && moved) {+ this.suppressLinkClick = true;+ this.cancelPointer();+ this.inspector.hidden = !this.selectedId || this.readOnly;+ this.renderInspector();+ return;+ }if (pointer.summary) {this.suppressLinkClick = true;pointer.summary = false;@@ -2628,12 +2709,13 @@ export class ListMindmapView {this.cancelPointer();if (moved && id && targetId && placement) {this.options.onMove?.(id, targetId, placement);- } else if (!moved && !id && !pointer.rightButton && !this.readOnly && !this.panning) {+ } else if (!moved && !pointer.nodeId && !pointer.rightButton && !this.readOnly && !this.panning) {if (this.editingId) {this.clearSelection();}this.finishThen(() => {this.options.host.focus({preventScroll: true});+ this.clearSelection();this.selectLine(event);});}@@ -3089,23 +3171,43 @@ export class ListMindmapView {this.draw();}- private pasteImages = (event: ClipboardEvent) => {+ private copySelection = (event: ClipboardEvent) => {+ const cut = event.type === "cut";+ if (event.defaultPrevented || this.editingId || this.relationFrom || this.summarySelecting ||+ cut && this.readOnly || !this.options.onCopy || !this.getSelectedIds().length ||+ (event.target as HTMLElement).isContentEditable ||+ (event.target as HTMLElement).closest("input, textarea, select")) {+ return;+ }+ event.preventDefault();+ this.options.onCopy(this.getSelectedIds(), cut, cut ? undefined : event);+ };++ private pasteSelection = (event: ClipboardEvent) => {if (event.defaultPrevented || this.readOnly || this.editingId || this.relationFrom || this.summarySelecting ||- !this.options.onPasteImages || !this.selectedId ||+ !this.options.onPaste || this.getSelectedIds().length !== 1 ||(event.target as HTMLElement).isContentEditable ||(event.target as HTMLElement).closest("input, textarea, select")) {return;}const id = this.selectedId;const node = this.model.nodes.get(id);- const files = Array.from(event.clipboardData?.files || []).filter(file => file.type.startsWith("image/"));- if (!node || node.virtual || files.length === 0) {+ const data: IClipboardData = {+ files: Array.from(event.clipboardData?.files || []),+ textPlain: event.clipboardData?.getData("text/plain"),+ textHTML: event.clipboardData?.getData("text/html"),+ siyuanHTML: event.clipboardData?.getData("text/siyuan"),+ };+ const kind = this.pasteSibling ? "sibling" : "child";+ this.pasteSibling = false;+ if (!node || node.virtual && kind === "sibling" ||+ !data.files.length && !data.textPlain && !data.textHTML && !data.siyuanHTML) {return;}event.preventDefault();this.finishThen(() => {if (!this.readOnly && this.selectedId === id && this.model.nodes.has(id)) {- this.options.onPasteImages(id, files);+ this.options.onPaste(id, kind, data);}});};@@ -3131,6 +3233,30 @@ export class ListMindmapView {if (this.pointer?.relation && event.key !== "Escape") {return;}+ if (!startingComposition && !this.editingId && !this.summarySelecting && !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";+ if (!cut || !this.readOnly) {+ event.preventDefault();+ event.stopPropagation();+ this.options.onCopy(this.getSelectedIds(), cut);+ }+ return;+ }+ if (!startingComposition && (event.ctrlKey || event.metaKey) && !event.altKey &&+ event.key.toLowerCase() === "v" && !this.editingId && !this.summarySelecting && !this.relationFrom &&+ !this.readOnly && this.options.onPaste && this.getSelectedIds().length === 1) {+ this.pasteSibling = event.shiftKey;+ // Shift+V 在部分宿主中会被解释为纯文本粘贴,直接读取完整载荷以保留节点结构。+ if (event.shiftKey) {+ event.preventDefault();+ this.pasteSibling = false;+ this.options.onPaste(this.selectedId, "sibling");+ }+ event.stopPropagation();+ return;+ }if (this.summarySelecting && event.key !== "Escape") {if (startingComposition || event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) {return;@@ -3292,6 +3418,7 @@ export class ListMindmapView {return;}this.relationFrom = undefined;+ this.multiSelect = false;this.cancelSummarySelection();this.inspector.hidden = true;if (this.fullscreenMarker && !selectingSummary) {@@ -3395,6 +3522,27 @@ export class ListMindmapView {return;}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);+ if (this.options.onClipboardMenu) {+ const more = squareButton("more", "iconMore", () => this.options.onClipboardMenu(more, ids));+ more.setAttribute("aria-haspopup", "menu");+ 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);+ return;+ }const style = this.model.metadata.nodes[id] || {};const change = (patch: Partial<ListMindmapNodeStyle>) => this.options.onNodeStyle?.(id, patch);this.inspector.append(this.buttons.get("relation"), this.buttons.get("summary"));