An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:lipstick: Improve mind map relationship arrow direction controls https://github.com/siyuan-note/siyuan/issues/20016
Danielf8977e3db768
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.jsonindex f80351ec6c..77e6f68e70 100644--- a/app/appearance/langs/ar.json+++ b/app/appearance/langs/ar.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "اتجاه السهم",+ "listMindmapArrowForward": "سهم أمامي",+ "listMindmapArrowReverse": "سهم عكسي",+ "listMindmapArrowBoth": "أسهم عند الطرفين",+ "listMindmapArrowNone": "بلا أسهم","ocrProvider": "موفّر OCR","ocrProviderTip": "التعرّف دون اتصال في النواة المحلية؛ ثبّت Tesseract بشكل منفصل؛ لا يتم التبديل تلقائيًا عند عدم التوفر","ocrAuto": "OCR تلقائي",diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.jsonindex 1736719de9..33a7573166 100644--- a/app/appearance/langs/de.json+++ b/app/appearance/langs/de.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Pfeilrichtung",+ "listMindmapArrowForward": "Vorwärtspfeil",+ "listMindmapArrowReverse": "Rückwärtspfeil",+ "listMindmapArrowBoth": "Pfeile an beiden Enden",+ "listMindmapArrowNone": "Keine Pfeile","ocrProvider": "OCR-Anbieter","ocrProviderTip": "Offline-Erkennung im lokalen Kernel; Tesseract separat installieren; kein automatischer Wechsel bei Nichtverfügbarkeit","ocrAuto": "Automatische OCR",diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.jsonindex b666a58e2f..2cef585534 100644--- a/app/appearance/langs/en.json+++ b/app/appearance/langs/en.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Arrow direction",+ "listMindmapArrowForward": "Forward arrow",+ "listMindmapArrowReverse": "Reverse arrow",+ "listMindmapArrowBoth": "Arrows at both ends",+ "listMindmapArrowNone": "No arrows","ocrProvider": "OCR provider","ocrProviderTip": "Recognize offline in the local kernel; install Tesseract separately; unavailable providers do not fall back automatically","ocrAuto": "Automatic OCR",diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.jsonindex 8f4b9dc2a4..09a73f8ef4 100644--- a/app/appearance/langs/es.json+++ b/app/appearance/langs/es.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Dirección de la flecha",+ "listMindmapArrowForward": "Flecha hacia delante",+ "listMindmapArrowReverse": "Flecha inversa",+ "listMindmapArrowBoth": "Flechas en ambos extremos",+ "listMindmapArrowNone": "Sin flechas","ocrProvider": "Proveedor de OCR","ocrProviderTip": "Reconocimiento sin conexión en el núcleo local; instale Tesseract por separado; no se cambia automáticamente si no está disponible","ocrAuto": "OCR automático",diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.jsonindex 9e87898e5f..b2f4fe4f00 100644--- a/app/appearance/langs/fr.json+++ b/app/appearance/langs/fr.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Direction de la flèche",+ "listMindmapArrowForward": "Flèche vers l’avant",+ "listMindmapArrowReverse": "Flèche inversée",+ "listMindmapArrowBoth": "Flèches aux deux extrémités",+ "listMindmapArrowNone": "Aucune flèche","ocrProvider": "Fournisseur OCR","ocrProviderTip": "Reconnaissance hors ligne dans le noyau local ; installez Tesseract séparément ; aucun changement automatique en cas d’indisponibilité","ocrAuto": "OCR automatique",diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.jsonindex 38190055b2..dc517bb92b 100644--- a/app/appearance/langs/he.json+++ b/app/appearance/langs/he.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "כיוון החץ",+ "listMindmapArrowForward": "חץ קדימה",+ "listMindmapArrowReverse": "חץ הפוך",+ "listMindmapArrowBoth": "חצים בשני הקצוות",+ "listMindmapArrowNone": "ללא חצים","ocrProvider": "ספק OCR","ocrProviderTip": "זיהוי לא מקוון בליבה המקומית; יש להתקין את Tesseract בנפרד; אין מעבר אוטומטי כשהספק אינו זמין","ocrAuto": "OCR אוטומטי",diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.jsonindex 6ccdceda3d..2ea7361498 100644--- a/app/appearance/langs/hi.json+++ b/app/appearance/langs/hi.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "तीर की दिशा",+ "listMindmapArrowForward": "आगे की ओर तीर",+ "listMindmapArrowReverse": "उलटी दिशा में तीर",+ "listMindmapArrowBoth": "दोनों सिरों पर तीर",+ "listMindmapArrowNone": "कोई तीर नहीं","ocrProvider": "OCR प्रदाता","ocrProviderTip": "स्थानीय कर्नेल में ऑफ़लाइन पहचान; Tesseract अलग से स्थापित करें; अनुपलब्ध होने पर प्रदाता अपने आप नहीं बदलेगा","ocrAuto": "स्वचालित OCR",diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.jsonindex 360e8fb2ef..a092b7d119 100644--- a/app/appearance/langs/id.json+++ b/app/appearance/langs/id.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Arah panah",+ "listMindmapArrowForward": "Panah maju",+ "listMindmapArrowReverse": "Panah terbalik",+ "listMindmapArrowBoth": "Panah di kedua ujung",+ "listMindmapArrowNone": "Tanpa panah","ocrProvider": "Penyedia OCR","ocrProviderTip": "Pengenalan luring di kernel lokal; pasang Tesseract secara terpisah; tidak berpindah otomatis saat tidak tersedia","ocrAuto": "OCR otomatis",diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.jsonindex cda9a8b12b..fd3e2ff5c2 100644--- a/app/appearance/langs/it.json+++ b/app/appearance/langs/it.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Direzione della freccia",+ "listMindmapArrowForward": "Freccia in avanti",+ "listMindmapArrowReverse": "Freccia inversa",+ "listMindmapArrowBoth": "Frecce a entrambe le estremità",+ "listMindmapArrowNone": "Nessuna freccia","ocrProvider": "Fornitore OCR","ocrProviderTip": "Riconoscimento offline nel kernel locale; installare Tesseract separatamente; nessun cambio automatico se non disponibile","ocrAuto": "OCR automatico",diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.jsonindex 7f1b485e6c..ce9e19d4cf 100644--- a/app/appearance/langs/ja.json+++ b/app/appearance/langs/ja.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "矢印の方向",+ "listMindmapArrowForward": "順方向の矢印",+ "listMindmapArrowReverse": "逆方向の矢印",+ "listMindmapArrowBoth": "両端に矢印",+ "listMindmapArrowNone": "矢印なし","ocrProvider": "OCR プロバイダー","ocrProviderTip": "ローカルカーネルでオフライン認識します。Tesseract は別途インストールが必要です。利用できない場合も自動切り替えは行いません","ocrAuto": "自動 OCR",diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.jsonindex 9178591c69..2283b10f22 100644--- a/app/appearance/langs/ko.json+++ b/app/appearance/langs/ko.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "화살표 방향",+ "listMindmapArrowForward": "정방향 화살표",+ "listMindmapArrowReverse": "역방향 화살표",+ "listMindmapArrowBoth": "양쪽 끝 화살표",+ "listMindmapArrowNone": "화살표 없음","ocrProvider": "OCR 제공자","ocrProviderTip": "로컬 커널에서 오프라인으로 인식합니다. Tesseract는 별도로 설치해야 하며, 사용할 수 없어도 자동으로 전환하지 않습니다","ocrAuto": "자동 OCR",diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.jsonindex 8ae374ec58..0fa2aacdbe 100644--- a/app/appearance/langs/nl.json+++ b/app/appearance/langs/nl.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Pijlrichting",+ "listMindmapArrowForward": "Pijl vooruit",+ "listMindmapArrowReverse": "Omgekeerde pijl",+ "listMindmapArrowBoth": "Pijlen aan beide uiteinden",+ "listMindmapArrowNone": "Geen pijlen","ocrProvider": "OCR-provider","ocrProviderTip": "Offline herkennen in de lokale kernel; installeer Tesseract afzonderlijk; geen automatische wissel bij onbeschikbaarheid","ocrAuto": "Automatische OCR",diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.jsonindex 219ad525d3..7e570ac1f7 100644--- a/app/appearance/langs/pl.json+++ b/app/appearance/langs/pl.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Kierunek strzałki",+ "listMindmapArrowForward": "Strzałka do przodu",+ "listMindmapArrowReverse": "Strzałka odwrotna",+ "listMindmapArrowBoth": "Strzałki na obu końcach",+ "listMindmapArrowNone": "Bez strzałek","ocrProvider": "Dostawca OCR","ocrProviderTip": "Rozpoznawanie offline w lokalnym jądrze; zainstaluj Tesseract oddzielnie; brak automatycznej zmiany w razie niedostępności","ocrAuto": "Automatyczny OCR",diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.jsonindex 048d980120..1fbdf924e5 100644--- a/app/appearance/langs/pt-BR.json+++ b/app/appearance/langs/pt-BR.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Direção da seta",+ "listMindmapArrowForward": "Seta para frente",+ "listMindmapArrowReverse": "Seta invertida",+ "listMindmapArrowBoth": "Setas nas duas extremidades",+ "listMindmapArrowNone": "Sem setas","ocrProvider": "Provedor de OCR","ocrProviderTip": "Reconhecimento offline no núcleo local; instale o Tesseract separadamente; não há troca automática se estiver indisponível","ocrAuto": "OCR automático",diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.jsonindex 1ef13ad937..fbeabccdaa 100644--- a/app/appearance/langs/ru.json+++ b/app/appearance/langs/ru.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Направление стрелки",+ "listMindmapArrowForward": "Прямая стрелка",+ "listMindmapArrowReverse": "Обратная стрелка",+ "listMindmapArrowBoth": "Стрелки на обоих концах",+ "listMindmapArrowNone": "Без стрелок","ocrProvider": "Провайдер OCR","ocrProviderTip": "Распознавание офлайн в локальном ядре; установите Tesseract отдельно; автоматического переключения при недоступности нет","ocrAuto": "Автоматический OCR",diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.jsonindex a079cda2af..5a0d9c4281 100644--- a/app/appearance/langs/sk.json+++ b/app/appearance/langs/sk.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Smer šípky",+ "listMindmapArrowForward": "Šípka vpred",+ "listMindmapArrowReverse": "Opačná šípka",+ "listMindmapArrowBoth": "Šípky na oboch koncoch",+ "listMindmapArrowNone": "Bez šípok","ocrProvider": "Poskytovateľ OCR","ocrProviderTip": "Rozpoznávanie offline v lokálnom jadre; Tesseract nainštalujte samostatne; pri nedostupnosti sa poskytovateľ automaticky nemení","ocrAuto": "Automatické OCR",diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.jsonindex 174e812510..8bdade9e52 100644--- a/app/appearance/langs/sr.json+++ b/app/appearance/langs/sr.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Смер стрелице",+ "listMindmapArrowForward": "Стрелица унапред",+ "listMindmapArrowReverse": "Обрнута стрелица",+ "listMindmapArrowBoth": "Стрелице на оба краја",+ "listMindmapArrowNone": "Без стрелица","ocrProvider": "OCR добављач","ocrProviderTip": "Препознавање ван мреже у локалном језгру; Tesseract инсталирајте засебно; нема аутоматске промене ако није доступан","ocrAuto": "Аутоматски OCR",diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.jsonindex 1ae43c8e69..3da8d3cfbd 100644--- a/app/appearance/langs/th.json+++ b/app/appearance/langs/th.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "ทิศทางลูกศร",+ "listMindmapArrowForward": "ลูกศรไปข้างหน้า",+ "listMindmapArrowReverse": "ลูกศรย้อนกลับ",+ "listMindmapArrowBoth": "ลูกศรทั้งสองด้าน",+ "listMindmapArrowNone": "ไม่มีลูกศร","ocrProvider": "ผู้ให้บริการ OCR","ocrProviderTip": "รู้จำแบบออฟไลน์ในเคอร์เนลของเครื่อง ต้องติดตั้ง Tesseract แยกต่างหาก และจะไม่สลับโดยอัตโนมัติเมื่อใช้งานไม่ได้","ocrAuto": "OCR อัตโนมัติ",diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.jsonindex 3edee7754d..3207305eaf 100644--- a/app/appearance/langs/tr.json+++ b/app/appearance/langs/tr.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Ok yönü",+ "listMindmapArrowForward": "İleri ok",+ "listMindmapArrowReverse": "Ters ok",+ "listMindmapArrowBoth": "Her iki uçta ok",+ "listMindmapArrowNone": "Ok yok","ocrProvider": "OCR sağlayıcısı","ocrProviderTip": "Yerel çekirdekte çevrimdışı tanıma; Tesseract ayrı kurulmalıdır; kullanılamadığında otomatik geçiş yapılmaz","ocrAuto": "Otomatik OCR",diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.jsonindex 1a808bd82d..922c66a3a4 100644--- a/app/appearance/langs/uk.json+++ b/app/appearance/langs/uk.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "Напрямок стрілки",+ "listMindmapArrowForward": "Пряма стрілка",+ "listMindmapArrowReverse": "Зворотна стрілка",+ "listMindmapArrowBoth": "Стрілки на обох кінцях",+ "listMindmapArrowNone": "Без стрілок","ocrProvider": "Провайдер OCR","ocrProviderTip": "Розпізнавання офлайн у локальному ядрі; встановіть Tesseract окремо; автоматичного перемикання за недоступності немає","ocrAuto": "Автоматичний OCR",diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.jsonindex 31a5530984..5d065d0151 100644--- a/app/appearance/langs/zh-CN.json+++ b/app/appearance/langs/zh-CN.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "箭头方向",+ "listMindmapArrowForward": "正向箭头",+ "listMindmapArrowReverse": "反向箭头",+ "listMindmapArrowBoth": "双向箭头",+ "listMindmapArrowNone": "无箭头","ocrProvider": "OCR 提供商","ocrProviderTip": "由本机内核离线识别;Tesseract 需自行安装;不可用时不会自动切换","ocrAuto": "自动 OCR",diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.jsonindex 835edd4fae..ddca7924d8 100644--- a/app/appearance/langs/zh-TW.json+++ b/app/appearance/langs/zh-TW.json@@ -1,4 +1,9 @@{+ "listMindmapArrowDirection": "箭頭方向",+ "listMindmapArrowForward": "正向箭頭",+ "listMindmapArrowReverse": "反向箭頭",+ "listMindmapArrowBoth": "雙向箭頭",+ "listMindmapArrowNone": "無箭頭","ocrProvider": "OCR 提供者","ocrProviderTip": "由本機核心離線辨識;Tesseract 需自行安裝;無法使用時不會自動切換","ocrAuto": "自動 OCR",diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.syindex 762baa3ffb..1a2c419be7 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy@@ -6,7 +6,7 @@"id": "20200924101225-k254i8g","title": "Content Block Type","type": "doc",- "updated": "20260930234403"+ "updated": "20261001015635"},"Children": [{@@ -1405,7 +1405,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091538-a55chyw",- "updated": "20260928225427"+ "updated": "20261001015635"},"Children": [{@@ -2533,7 +2533,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-r1kfene",- "updated": "20260926151827"+ "updated": "20261001015635"},"Children": [{@@ -2579,6 +2579,79 @@}]},+ {+ "ID": "20261001015635-my9v7og",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-my9v7og",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Select a relation line and use "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Arrow direction"+ },+ {+ "Type": "NodeText",+ "Data": " in the bottom settings to choose "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Forward arrow"+ },+ {+ "Type": "NodeText",+ "Data": " (start to end, the default), "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Reverse arrow"+ },+ {+ "Type": "NodeText",+ "Data": " (end to start), "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Arrows at both ends"+ },+ {+ "Type": "NodeText",+ "Data": ", or "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "No arrows"+ },+ {+ "Type": "NodeText",+ "Data": ". Changing direction preserves the connected nodes, label, and manual path, supports undo and redo, and does not affect parent-child lines."+ }+ ]+ },+ {+ "ID": "20261001015635-yca6fy3",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-yca6fy3",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "On a selected relation, the hollow circle marks the start and the filled circle marks the end, regardless of arrow direction. Drag a circle to change the connected node. Attachment positions on each node remain automatic."+ }+ ]+ },{"ID": "20260926151827-kkcg79g","Type": "NodeParagraph",diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.syindex eb51acc450..a5b5be93eb 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy@@ -6,7 +6,7 @@"id": "20200905090211-2vixtlf","title": "内容块类型","type": "doc",- "updated": "20260930234403"+ "updated": "20261001015635"},"Children": [{@@ -1438,7 +1438,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104090624-9qgquxh",- "updated": "20260928225427"+ "updated": "20261001015635"},"Children": [{@@ -2612,7 +2612,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-j34ty5i",- "updated": "20260926151827"+ "updated": "20261001015635"},"Children": [{@@ -2658,6 +2658,79 @@}]},+ {+ "ID": "20261001015635-pbhnzjy",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-pbhnzjy",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "选中关系线后,使用底部设置中的 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "箭头方向"+ },+ {+ "Type": "NodeText",+ "Data": ",可选择 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "正向箭头"+ },+ {+ "Type": "NodeText",+ "Data": "(从起点指向终点,默认)、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "反向箭头"+ },+ {+ "Type": "NodeText",+ "Data": "(从终点指向起点)、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "双向箭头"+ },+ {+ "Type": "NodeText",+ "Data": " 或 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "无箭头"+ },+ {+ "Type": "NodeText",+ "Data": "。切换方向保留连接节点、关系文字和手动路径,支持撤销和重做,不影响父子节点之间的连线。"+ }+ ]+ },+ {+ "ID": "20261001015635-ls0c0dv",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-ls0c0dv",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "选中关系线后,空心圆表示连接起点,实心圆表示连接终点,与箭头方向无关。拖动圆形手柄可以更换对应的连接节点;节点上的具体连接位置仍由系统自动选择。"+ }+ ]+ },{"ID": "20260926151827-8wl1iml","Type": "NodeParagraph",diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.syindex 1e9af60d12..fae7bc8e63 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy@@ -6,7 +6,7 @@"id": "20211226120147-ib6yy3i","title": "內容區塊類型","type": "doc",- "updated": "20260930234403"+ "updated": "20261001015635"},"Children": [{@@ -1434,7 +1434,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226120227-esm6f20",- "updated": "20260928225427"+ "updated": "20261001015635"},"Children": [{@@ -2548,7 +2548,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-cfx2ewc",- "updated": "20260926151827"+ "updated": "20261001015635"},"Children": [{@@ -2594,6 +2594,79 @@}]},+ {+ "ID": "20261001015635-0kuzxlx",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-0kuzxlx",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "選取關係線後,使用底部設定中的 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "箭頭方向"+ },+ {+ "Type": "NodeText",+ "Data": ",可選擇 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "正向箭頭"+ },+ {+ "Type": "NodeText",+ "Data": "(從起點指向終點,預設)、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "反向箭頭"+ },+ {+ "Type": "NodeText",+ "Data": "(從終點指向起點)、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "雙向箭頭"+ },+ {+ "Type": "NodeText",+ "Data": " 或 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "無箭頭"+ },+ {+ "Type": "NodeText",+ "Data": "。切換方向會保留連接節點、關係文字與手動路徑,支援復原與重做,不影響父子節點之間的連線。"+ }+ ]+ },+ {+ "ID": "20261001015635-wjlw51s",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-wjlw51s",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "選取關係線後,空心圓表示連接起點,實心圓表示連接終點,與箭頭方向無關。拖曳圓形控制點可以變更對應的連接節點;節點上的具體連接位置仍由系統自動選擇。"+ }+ ]+ },{"ID": "20260926151827-6pycwgr","Type": "NodeParagraph",diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.syindex 9d34d2f979..29fa3dcbe7 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy@@ -7,7 +7,7 @@"id": "20240530101000-35bbvcx","title": "コンテンツブロックの種類","type": "doc",- "updated": "20260930234403"+ "updated": "20261001015635"},"Children": [{@@ -1491,7 +1491,7 @@"Properties": {"ID": "20240530101000-rjjxxn8","id": "20240530101000-p035stn",- "updated": "20260928225427"+ "updated": "20261001015635"},"Children": [{@@ -2699,7 +2699,7 @@"HeadingLevel": 3,"Properties": {"id": "20260921215916-odykie5",- "updated": "20260926151827"+ "updated": "20261001015635"},"Children": [{@@ -2745,6 +2745,79 @@}]},+ {+ "ID": "20261001015635-vr2ykf2",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-vr2ykf2",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "関連線を選択し、下部の設定にある "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "矢印の方向"+ },+ {+ "Type": "NodeText",+ "Data": " で "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "順方向の矢印"+ },+ {+ "Type": "NodeText",+ "Data": "(始点から終点、既定)、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "逆方向の矢印"+ },+ {+ "Type": "NodeText",+ "Data": "(終点から始点)、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "両端に矢印"+ },+ {+ "Type": "NodeText",+ "Data": "、"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "矢印なし"+ },+ {+ "Type": "NodeText",+ "Data": " を選択できます。方向を変更しても接続先のノード、ラベル、手動の経路は保持され、元に戻す・やり直しに対応しています。親子ノード間の線には影響しません。"+ }+ ]+ },+ {+ "ID": "20261001015635-wnnepvh",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261001015635-wnnepvh",+ "updated": "20261001015635"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "関連線を選択すると、矢印の方向にかかわらず、白抜きの円は接続の始点、塗りつぶした円は終点を示します。円形のハンドルをドラッグすると、接続先のノードを変更できます。各ノード上の具体的な接続位置は自動的に選択されます。"+ }+ ]+ },{"ID": "20260926151827-vknoaqd","Type": "NodeParagraph",diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scssindex 0619341a38..5b58434de9 100644--- a/app/src/assets/scss/protyle/_mindmap-view.scss+++ b/app/src/assets/scss/protyle/_mindmap-view.scss@@ -795,7 +795,8 @@flex-shrink: 0;}- > button {+ > button,+ > select {flex-shrink: 0;}}diff --git a/app/src/protyle/render/listMindmap/arrows.test.ts b/app/src/protyle/render/listMindmap/arrows.test.tsnew file mode 100644index 0000000000..798e1b33ce--- /dev/null+++ b/app/src/protyle/render/listMindmap/arrows.test.ts@@ -0,0 +1,211 @@+import * as assert from "node:assert/strict";+import {readFileSync} from "node:fs";+import test from "node:test";+import {runInNewContext} from "node:vm";+import {createSourceFile, isClassDeclaration, ScriptTarget, transpileModule} from "typescript";+import type {ListMindmapRelation} from "./model";++// 执行实际绘制和命中方法,画布替身仅记录路径与箭头,避免依赖图形显示环境。+const source = createSourceFile("view.ts", readFileSync("src/protyle/render/listMindmap/view.ts", "utf8"),+ ScriptTarget.ES2021, true);+const view = source.statements.find(item => isClassDeclaration(item) && item.name?.text === "ListMindmapView");+assert.ok(view && isClassDeclaration(view));+const methods = view.members.filter(item => ["relationPath", "draw", "findLine", "renderInspector"].includes(item.name?.getText(source)));+assert.equal(methods.length, 4);+const compiled = transpileModule(`class View {+ ${methods.map(item => item.getText(source)).join("\n")}+}+globalThis.View = View;`, {compilerOptions: {target: ScriptTarget.ES2021}}).outputText;++type Point = {x: number, y: number};+class TestPath {+ public points: Point[] = [];+ moveTo(x: number, y: number) { this.points.push({x, y}); }+ lineTo(x: number, y: number) { this.points.push({x, y}); }+ bezierCurveTo(_a: number, _b: number, _c: number, _d: number, x: number, y: number) { this.lineTo(x, y); }+ quadraticCurveTo(_a: number, _b: number, x: number, y: number) { this.lineTo(x, y); }+}++const setup = (arrowDirection?: ListMindmapRelation["arrowDirection"]) => {+ let polygon: Point[] = [];+ const polygons: Point[][] = [];+ const strokes: TestPath[] = [];+ const context = {+ strokeHit: false,+ setTransform: () => {}, clearRect: () => {}, translate: () => {}, scale: () => {},+ setLineDash: () => {}, closePath: () => {}, save: () => {}, restore: () => {}, resetTransform: () => {},+ beginPath: () => { polygon = []; },+ moveTo: (x: number, y: number) => polygon.push({x, y}),+ lineTo: (x: number, y: number) => polygon.push({x, y}),+ fill: () => polygons.push(polygon),+ stroke: (path: TestPath) => strokes.push(path),+ isPointInStroke: () => context.strokeHit,+ };+ const sandbox: any = {+ Path2D: TestPath, window: {devicePixelRatio: 1},+ getComputedStyle: (element: {style?: {color?: string}}) => ({+ getPropertyValue: () => "", color: element.style?.color || "black",+ }),+ };+ runInNewContext(compiled, sandbox);+ const target = new sandbox.View();+ const relation: ListMindmapRelation = {id: "r", from: "a", to: "b", label: "Keep"};+ if (arrowDirection !== undefined) {+ relation.arrowDirection = arrowDirection;+ }+ const element = () => ({hidden: false, offsetWidth: 0, offsetHeight: 0,+ style: {}, classList: {toggle: () => {}}});+ Object.assign(target, {+ scale: 1, offsetX: 0, offsetY: 0, world: {style: {}}, zoomLabel: {}, zoomSlider: {},+ viewport: {clientWidth: 400, clientHeight: 200, getBoundingClientRect: () => ({left: 0, top: 0})},+ canvas: {getContext: () => context}, options: {host: {}}, colorProbe: {style: {}},+ model: {root: {id: "a"}, metadata: {nodes: {}, relations: [relation]}}, edges: [],+ positions: new Map([["a", {id: "a", x: 100, y: 0, width: 20, height: 20}],+ ["b", {id: "b", x: -20, y: 0, width: 20, height: 20}]]),+ relationElements: new Map([["r", element()]]),+ relationRoutes: new Map([["r", [{x: 100, y: 10}, {x: 0, y: 10}]]]),+ routingObstacles: () => [], drawRelationPreview: () => {}, drawSummaries: () => {}, renderRouteControls: () => {},+ });+ return {target, context, polygons, strokes, element};+};++test("all arrow modes use endpoint identity rather than canonical path drawing order", () => {+ for (const mode of [undefined, "forward", "reverse", "both", "none"] as const) {+ for (const scale of [.5, 1, 2]) {+ const {target, polygons, strokes} = setup(mode);+ target.scale = scale;+ target.draw();+ const tips = mode === "none" ? [] : mode === "reverse" ? [100] : mode === "both" ? [0, 100] : [0];+ assert.equal(polygons.length, tips.length);+ assert.deepEqual(polygons.map(polygon => polygon[1].x), tips);+ assert.equal(strokes.length, 1);+ assert.equal(strokes[0].points[0].x, 0, "dash drawing order is independent of from/to");+ assert.deepEqual(Array.from(target.linePaths[0].arrows, (tip: Point) => tip.x), tips);+ polygons.forEach((polygon, index) => {+ assert.ok(tips[index] === 0 ? polygon[0].x > 0 : polygon[0].x < 100,+ "arrowheads point outwards at each logical endpoint");+ });+ }+ }+});++test("hit testing follows only visible arrowheads and keeps no-arrow paths selectable", () => {+ for (const mode of ["forward", "reverse", "both", "none"] as const) {+ for (const scale of [.5, 1, 2]) {+ const {target, context} = setup(mode);+ target.scale = scale;+ target.draw();+ const find = (x: number) => target.findLine({clientX: x * scale, clientY: 10 * scale});+ assert.equal(find(0)?.id, mode === "forward" || mode === "both" ? "r" : undefined);+ assert.equal(find(100)?.id, mode === "reverse" || mode === "both" ? "r" : undefined);+ context.strokeHit = true;+ assert.equal(find(50)?.id, "r", "the line itself remains selectable in every mode");+ }+ }+});++test("overlapping opposite relations retain separate identity and selected-arrow priority", () => {+ const {target, element, context} = setup("both");+ target.model.metadata.relations.push({id: "other", from: "b", to: "a", label: "", arrowDirection: "both"});+ target.relationElements.set("other", element());+ target.relationRoutes.set("other", [{x: 0, y: 10}, {x: 100, y: 10}]);+ for (const selected of ["r", "other"]) {+ target.selectedRelation = selected;+ target.draw();+ for (const x of [0, 100]) {+ assert.equal(target.findLine({clientX: x, clientY: 10}).id, selected);+ }+ context.strokeHit = true;+ assert.equal(target.findLine({clientX: 50, clientY: 10}).id, selected);+ context.strokeHit = false;+ }+});++test("short bidirectional arrows stay separated and hierarchy lines have no arrows", () => {+ const {target, polygons, strokes} = setup("both");+ target.relationRoutes.set("r", [{x: 8, y: 10}, {x: 0, y: 10}]);+ target.edges = [{from: "a", to: "b"}];+ target.draw();+ assert.equal(polygons.length, 2);+ assert.equal(strokes.length, 2);+ assert.ok(Math.max(...polygons[0].map(point => point.x)) < Math.min(...polygons[1].map(point => point.x)));+ assert.equal(target.linePaths.find((line: {relation: boolean}) => !line.relation).arrows, undefined);+});++test("read-only and print rendering retain all saved arrow modes", () => {+ for (const mode of ["forward", "reverse", "both", "none"] as const) {+ const normal = setup(mode);+ normal.target.draw();+ for (const printLayout of [false, true]) {+ const {target, polygons} = setup(mode);+ target.readOnly = true;+ target.options.printLayout = printLayout;+ target.draw();+ assert.deepEqual(polygons, normal.polygons);+ }+ }+});++test("the shared direction selector preserves focus and only patches arrow direction", () => {+ const focusState: {activeElement?: Control} = {};+ class Control {+ public children: Control[] = [];+ public attributes = new Map<string, string>();+ public style: Record<string, string> = {};+ public classList = {add: () => {}, toggle: () => {}};+ public events = new Map<string, () => void>();+ public hidden = false;+ public value = "";+ public textContent = "";+ constructor(public tag: string) {}+ append(...elements: Control[]) { this.children.push(...elements); }+ replaceChildren() { this.children = []; }+ querySelector(tag: string): Control | undefined {+ for (const child of this.children) {+ const result = child.tag === tag ? child : child.querySelector(tag);+ if (result) { return result; }+ }+ }+ setAttribute(name: string, value: string) { this.attributes.set(name, value); }+ addEventListener(name: string, callback: () => void) { this.events.set(name, callback); }+ focus() { focusState.activeElement = this; }+ }+ const changes: {id: string, patch: Partial<ListMindmapRelation>}[] = [];+ const sandbox: any = {+ document: {createElement: (tag: string) => new Control(tag), get activeElement() { return focusState.activeElement; }},+ createElement: (tag: string) => new Control(tag),+ };+ runInNewContext(compiled, sandbox);+ const target = new sandbox.View();+ const relation: ListMindmapRelation = {id: "r", from: "a", to: "b", label: "Keep"};+ Object.assign(target, {+ inspector: new Control("div"), selectedRelation: "r", model: {metadata: {relations: [relation]}},+ label: (key: string) => key,+ makeButton: () => {+ const button = new Control("button");+ button.append(new Control("svg"));+ return button;+ },+ options: {onRelationChange: (id: string, patch: Partial<ListMindmapRelation>) => changes.push({id, patch})},+ });+ target.renderInspector();+ let select: Control = target.inspector.querySelector("select");+ assert.equal(select.attributes.get("aria-label"), "listMindmapArrowDirection");+ assert.equal(select.value, "forward");+ assert.deepEqual(select.children.map(option => option.value), ["forward", "reverse", "both", "none"]);+ for (const arrowDirection of ["forward", "reverse", "both", "none"] as const) {+ select.focus();+ select.value = arrowDirection;+ select.events.get("change")();+ assert.deepEqual(JSON.parse(JSON.stringify(changes.pop())), {id: "r", patch: {arrowDirection}});+ relation.arrowDirection = arrowDirection;+ target.renderInspector();+ select = target.inspector.querySelector("select");+ assert.equal(focusState.activeElement, select);+ assert.equal(select.value, arrowDirection);+ }+ target.inspector.replaceChildren();+ target.readOnly = true;+ target.renderInspector();+ assert.equal(target.inspector.querySelector("select"), undefined, "read-only views expose no direction editor");+});diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex 94961881d6..767e95ea23 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -67,6 +67,22 @@ test("manual relation routes are optional, versioned and validated without dropp}});+test("relation arrow directions are optional and validated without dropping metadata", () => {+ const relation = {id: "r", from: "a", to: "b", label: "Keep", color: "red", extension: "keep",+ route: {version: 1, points: [{x: 10, y: 20, t: .5}]}};+ const metadata = {version: 1, nodes: {}, relations: [relation]};+ const original = JSON.stringify(metadata);+ assert.equal(JSON.stringify(parseListMindmapMetadata(original)), original);+ for (const arrowDirection of ["forward", "reverse", "both", "none"]) {+ const value = JSON.stringify({...metadata, relations: [{...relation, arrowDirection}]});+ assert.equal(JSON.stringify(parseListMindmapMetadata(value)), value);+ }+ for (const arrowDirection of [null, "", "backward", 0, false, {}, []]) {+ const value = JSON.stringify({...metadata, relations: [{...relation, arrowDirection}]});+ assert.throws(() => parseListMindmapMetadata(value), /Invalid list mindmap metadata/);+ }+});+test("summary metadata is optional and rejects damaged groups while retaining extension fields", () => {const old = '{"version":1,"rootTitle":"Root","nodes":{},"relations":[]}';assert.equal(JSON.stringify(parseListMindmapMetadata(old)), old);@@ -754,7 +770,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,const copiedRoute = {version: 1, points: [{x: -35, y: 20, t: .5}], extension: "keep"};list.setAttribute("custom-sy-list-mindmap-data", JSON.stringify({version: 1, extension: "keep",nodes: {a: {bold: true}, b: {italic: true}, deleted: {bold: true}},- relations: [{id: "relation", from: "a", to: "b", label: "keep", route: copiedRoute},+ relations: [{id: "relation", from: "a", to: "b", label: "keep", route: copiedRoute, arrowDirection: "both"},{id: "orphan", from: "a", to: "deleted", label: "remove"}]}));const copiedItems = list.querySelectorAll('[data-type="NodeListItem"]');copiedItems[0].setAttribute("data-node-id", "new-a");@@ -768,7 +784,8 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,api.remapListMindmapIDs(list, new Map([["a", "new-a"], ["b", "new-b"]]));const remapped = JSON.parse(list.getAttribute("custom-sy-list-mindmap-data"));check.deepEqual(remapped.nodes, {"new-a": {bold: true}, "new-b": {italic: true}});- check.deepEqual(remapped.relations, [{id: "relation", from: "new-a", to: "new-b", label: "keep", route: copiedRoute}]);+ check.deepEqual(remapped.relations, [{id: "relation", from: "new-a", to: "new-b", label: "keep",+ route: copiedRoute, arrowDirection: "both"}]);check.equal(remapped.extension, "keep");check.equal(list.querySelector(".mindmap-view"), null);check.equal(list.hasAttribute("data-mindmap-view-rendered"), false);@@ -1504,6 +1521,28 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.ok(Math.abs(lineMenuBounds.left + lineMenuBounds.width / 2 - panelBounds.left - panelBounds.width / 2) < 2);check.ok(lineMenuBounds.width < panelBounds.width / 2);check.equal(inspector.querySelector(".mindmap-view__section"), null);+ const arrowSelector = () => inspector.querySelector<HTMLSelectElement>('[aria-label="listMindmapArrowDirection"]');+ check.ok(arrowSelector().classList.contains("b3-select"));+ check.equal(arrowSelector().value, "forward", "old relations show the default arrow direction");+ check.equal(arrowSelector().options.length, 4);+ for (const arrowDirection of ["forward", "reverse", "both", "none"]) {+ const selector = arrowSelector();+ selector.focus();+ const keyboard = new KeyboardEvent("keydown", {key: "ArrowDown", bubbles: true, cancelable: true});+ selector.dispatchEvent(keyboard);+ check.equal(keyboard.defaultPrevented, false, "direction keys belong to the shared select control");+ selector.value = arrowDirection;+ selector.dispatchEvent(new Event("change", {bubbles: true}));+ check.deepEqual(relationChanges.pop(), ["relation-test", {arrowDirection}]);+ model.metadata.relations[0].arrowDirection = arrowDirection;+ view.update(model);+ await settle();+ check.equal(arrowSelector().value, arrowDirection);+ check.equal(document.activeElement, arrowSelector(), "changing direction preserves keyboard focus");+ }+ delete model.metadata.relations[0].arrowDirection;+ view.update(model);+ await settle();host.querySelector(".mindmap-view__relation").dispatchEvent(new MouseEvent("dblclick", {bubbles: true}));const relationLabel = host.querySelector<HTMLInputElement>(".mindmap-view__relation-editor");check.equal(document.activeElement, relationLabel);@@ -1601,7 +1640,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,view.scale = scale;view.draw();for (const id of ["forward", "reverse"]) {- const end = view.linePaths.find((line: any) => line.id === id).end;+ const end = view.linePaths.find((line: any) => line.id === id).arrows[0];const bounds = viewport.getBoundingClientRect();const x = bounds.left + view.offsetX + end.x * scale;const y = bounds.top + view.offsetY + end.y * scale;@@ -1777,7 +1816,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,view.selectedRelation = "drag-route";view.updateSelection();await settle();- const resetEnd = view.linePaths.find((line: any) => line.id === "drag-route").end;+ const resetEnd = view.linePaths.find((line: any) => line.id === "drag-route").arrows[0];const resetBounds = viewport.getBoundingClientRect();viewport.dispatchEvent(new MouseEvent("dblclick", {clientX: resetBounds.left + view.offsetX + resetEnd.x * view.scale,clientY: resetBounds.top + view.offsetY + resetEnd.y * view.scale, bubbles: true}));@@ -3358,6 +3397,7 @@ test("list mindmap mutations preserve block data in the real DOM and Lute", {compile(path.join(__dirname, "create.ts")) + compile(path.join(__dirname, "render.ts"));const css = require("sass").compile(path.resolve(__dirname, "../../../assets/scss/business/_block.scss")).css +require("sass").compile(path.resolve(__dirname, "../../../assets/scss/component/_button.scss")).css ++ require("sass").compile(path.resolve(__dirname, "../../../assets/scss/component/_select.scss")).css +require("sass").compile(path.resolve(__dirname, "../../../assets/scss/business/_color.scss")).css +require("sass").compile(path.resolve(__dirname, "../../../assets/scss/component/_tooltips.scss")).css +require("sass").compile(path.resolve(__dirname, "../../../assets/scss/protyle/_mindmap-view.scss")).css;diff --git a/app/src/protyle/render/listMindmap/model.ts b/app/src/protyle/render/listMindmap/model.tsindex 47b9c0924d..c3fd4f44ae 100644--- a/app/src/protyle/render/listMindmap/model.ts+++ b/app/src/protyle/render/listMindmap/model.ts@@ -26,6 +26,7 @@ export interface ListMindmapRelation {color?: string;width?: number;dash?: boolean;+ arrowDirection?: "forward" | "reverse" | "both" | "none";route?: MindmapManualRoute;}@@ -120,7 +121,9 @@ export const parseListMindmapMetadata = (value: string | null): ListMindmapMetad("color" in relation && typeof relation.color !== "string") ||("width" in relation && (typeof relation.width !== "number" ||!Number.isFinite(relation.width) || relation.width < 0)) ||- ("dash" in relation && typeof relation.dash !== "boolean")) {+ ("dash" in relation && typeof relation.dash !== "boolean") ||+ ("arrowDirection" in relation && (typeof relation.arrowDirection !== "string" ||+ !["forward", "reverse", "both", "none"].includes(relation.arrowDirection)))) {throw invalidMetadata();}if ("route" in relation) {diff --git a/app/src/protyle/render/listMindmap/relation.test.ts b/app/src/protyle/render/listMindmap/relation.test.tsindex b585aead23..1f2b9d67bf 100644--- a/app/src/protyle/render/listMindmap/relation.test.ts+++ b/app/src/protyle/render/listMindmap/relation.test.ts@@ -84,4 +84,21 @@ test("manual route save and reset use one transaction and reject stale relationdata.relations.push({...data.relations[0], id: "existing", from: "c"});target.onRelationChange("r", {from: "c"}, JSON.stringify(data.relations[0]));assert.equal(transactions.length, 3, "duplicate connections are checked against the current source data");+ for (const arrowDirection of ["forward", "reverse", "both", "none"]) {+ data = JSON.parse(saved);+ const before = JSON.stringify(data);+ target.onRelationChange("r", {arrowDirection});+ const transaction = transactions[transactions.length - 1];+ assert.equal(transaction.before, before, "undo retains the original relation and missing default field");+ assert.deepEqual(JSON.parse(transaction.after).relations[0], {+ ...JSON.parse(before).relations[0], arrowDirection,+ }, "direction changes preserve endpoints, manual route, text and styling");+ data = JSON.parse(transaction.before);+ assert.equal(JSON.stringify(data), before);+ data = JSON.parse(transaction.after);+ assert.equal(JSON.stringify(data), transaction.after, "redo restores the selected arrow mode");+ const count = transactions.length;+ target.onRelationChange("r", {arrowDirection});+ assert.equal(transactions.length, count, "choosing the current direction is a no-op");+ }});diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 287b1a623d..b555c3894b 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -135,7 +135,7 @@ export class ListMindmapView {private selectedEdge?: string;private hoveredLine?: string;private finishRelationEdit?: (save: boolean) => void;- private linePaths: {id: string, relation: boolean, summary?: boolean, path: Path2D, end?: MindmapRoutePoint}[] = [];+ private linePaths: {id: string, relation: boolean, summary?: boolean, path: Path2D, arrows?: MindmapRoutePoint[]}[] = [];private relationRoutes = new Map<string, MindmapRoutePoint[]>();private readonly routeHandles = new Map<string, HTMLButtonElement>();private readonly routeStatus = createElement("div", "mindmap-view__route-status");@@ -1227,6 +1227,8 @@ export class ListMindmapView {}const end = points[points.length - 1];const previous = points[points.length - 2];+ const start = points[0];+ const next = points[1];// 按整条路径限制箭头大小,短尾段不会把长关系线的箭头压小。const arrowSizeLimit = points.slice(1).reduce((length, point, i) =>length + Math.hypot(point.x - points[i].x, point.y - points[i].y), 0) / 3;@@ -1247,7 +1249,7 @@ export class ListMindmapView {const drawingEnd = drawingPoints[drawingPoints.length - 1];path.lineTo(drawingEnd.x, drawingEnd.y);if (!label) {- return {path, end, previous, arrowSizeLimit, labelPoint: undefined as MindmapRoutePoint | undefined};+ return {path, start, next, end, previous, arrowSizeLimit, labelPoint: undefined as MindmapRoutePoint | undefined};}const width = label.offsetWidth;const height = label.offsetHeight;@@ -1271,7 +1273,7 @@ export class ListMindmapView {// 调整关系线时隐藏文字,保留测量尺寸,避免遮挡手柄或改变节点布局。label.style.visibility = !labelPoint || (id === this.selectedRelation && !this.readOnly &&!this.printTransform && !this.options.printLayout) ? "hidden" : "";- return {path, end, previous, arrowSizeLimit, labelPoint};+ return {path, start, next, end, previous, arrowSizeLimit, labelPoint};}private calculateRelationRoute(relation: ListMindmapRelation | undefined, from: ListMindmapPosition, to: ListMindmapPosition) {@@ -1567,8 +1569,16 @@ export class ListMindmapView {element.hidden = true;return;}- const {path, end, previous, arrowSizeLimit, labelPoint} = route;- this.linePaths.push({id: relation.id, relation: true, path, end});+ const {path, start, next, end, previous, arrowSizeLimit, labelPoint} = route;+ const direction = relation.arrowDirection || "forward";+ const arrows = [];+ if (direction === "forward" || direction === "both") {+ arrows.push({tip: end, previous});+ }+ if (direction === "reverse" || direction === "both") {+ arrows.push({tip: start, previous: next});+ }+ this.linePaths.push({id: relation.id, relation: true, path, arrows: arrows.map(arrow => arrow.tip)});context.beginPath();const selected = relation.id === this.selectedRelation;const hovered = this.hoveredLine === `relation:${relation.id}`;@@ -1581,20 +1591,22 @@ export class ListMindmapView {context.setLineDash(relation.dash === false ? [] : [5, 4]);context.stroke(path);context.setLineDash([]);- context.beginPath();- const direction = Math.atan2(end.y - previous.y, end.x - previous.x);// 短线上的双向箭头预留间隙,避免合并成菱形。const arrowSize = Math.min(Math.max(7 / this.scale, baseWidth * 2), arrowSizeLimit);// 箭头随线条状态加宽,保持长度不变以保留双向箭头之间的间隙。const halfWidth = arrowSize / 2 + emphasis / 2;- const baseX = end.x - arrowSize * Math.cos(Math.PI / 6) * Math.cos(direction);- const baseY = end.y - arrowSize * Math.cos(Math.PI / 6) * Math.sin(direction);context.fillStyle = context.strokeStyle;- context.moveTo(baseX - halfWidth * Math.sin(direction), baseY + halfWidth * Math.cos(direction));- context.lineTo(end.x, end.y);- context.lineTo(baseX + halfWidth * Math.sin(direction), baseY - halfWidth * Math.cos(direction));- context.closePath();- context.fill();+ arrows.forEach(({tip, previous}) => {+ const angle = Math.atan2(tip.y - previous.y, tip.x - previous.x);+ const baseX = tip.x - arrowSize * Math.cos(Math.PI / 6) * Math.cos(angle);+ const baseY = tip.y - arrowSize * Math.cos(Math.PI / 6) * Math.sin(angle);+ context.beginPath();+ context.moveTo(baseX - halfWidth * Math.sin(angle), baseY + halfWidth * Math.cos(angle));+ context.lineTo(tip.x, tip.y);+ context.lineTo(baseX + halfWidth * Math.sin(angle), baseY - halfWidth * Math.cos(angle));+ context.closePath();+ context.fill();+ });if (labelPoint) {element.style.left = `${labelPoint.x}px`;element.style.top = `${labelPoint.y}px`;@@ -2146,14 +2158,13 @@ export class ListMindmapView {let arrow: typeof lines[number];let distance = 12 / this.scale;lines.forEach(item => {- if (!item.end) {- return;- }- const current = Math.hypot(item.end.x - x, item.end.y - y);- if (current < distance) {- distance = current;- arrow = item;- }+ item.arrows?.forEach(tip => {+ const current = Math.hypot(tip.x - x, tip.y - y);+ if (current < distance || (arrow && current === distance && item.id === this.selectedRelation)) {+ distance = current;+ arrow = item;+ }+ });});const hits = lines.filter(item => context.isPointInStroke(item.path, x, y));// 沿线移动或双击时保持已选关系,避免重新选中覆盖在上方的反向连接。@@ -2730,6 +2741,7 @@ export class ListMindmapView {if (this.inspector.hidden || this.readOnly) {return;}+ const focusArrowDirection = this.inspector.querySelector("select") === document.activeElement;this.inspector.replaceChildren();const lineSelected = !!this.selectedRelation || !!this.selectedEdge || !!this.selectedSummary;this.inspector.classList.toggle("mindmap-view__inspector--node", !lineSelected);@@ -2777,6 +2789,21 @@ export class ListMindmapView {}const change = (patch: Partial<ListMindmapRelation>) => this.options.onRelationChange?.(relation.id, patch);color(relation.color, value => change({color: value}));+ const direction = createElement("select", "b3-select");+ direction.setAttribute("aria-label", this.label("listMindmapArrowDirection"));+ for (const [value, key] of [["forward", "listMindmapArrowForward"], ["reverse", "listMindmapArrowReverse"],+ ["both", "listMindmapArrowBoth"], ["none", "listMindmapArrowNone"]]) {+ const option = document.createElement("option");+ option.value = value;+ option.textContent = this.label(key);+ direction.append(option);+ }+ direction.value = relation.arrowDirection || "forward";+ direction.addEventListener("change", () => change({arrowDirection: direction.value as ListMindmapRelation["arrowDirection"]}));+ this.inspector.append(direction);+ if (focusArrowDirection) {+ direction.focus({preventScroll: true});+ }this.inspector.append(squareButton("edit", "iconEdit", () => this.editRelationLabel()),squareButton("delete", "iconTrashcan", () => this.options.onRelationDelete?.(relation.id)));return;diff --git a/docs/LIST-MINDMAP.md b/docs/LIST-MINDMAP.mdindex 0c9214ade2..094b2a5261 100644--- a/docs/LIST-MINDMAP.md+++ b/docs/LIST-MINDMAP.md@@ -21,7 +21,8 @@- 点击画布空白处或脑图外部取消选中,收起节点样式及关系线设置;点击节点继续选择关系线终点,点击其他区域取消连线- 连接按钮使用带箭头的弯曲连线图标,位于缩小按钮前;先选择起点,再选择终点,可编辑文字、颜色或删除关系线;路径通过正交可视网格上的 A* 搜索避开节点和折叠、添加按钮区域,减少转弯并绘制圆角,布局变化时重新计算,平移和缩放时复用路径- 关系线支持直接拖动,选中后在线段上显示手柄;水平线段上下拖动,垂直线段左右拖动,首尾线段保留连接节点的引出段;拖动时固定节点布局和画布,实时预览避障路径,松手保存一次事务,Esc 或指针取消恢复原路径;双击拖拽手柄恢复自动计算,双击线条或文字编辑关系文字;只读及导出显示保存的路径,不显示调整手柄-- 选中关系线后,空心圆标出起点,实心圆标出箭头端;拖动圆形手柄更换对应节点,可连接的节点会高亮;松手后重新计算路径并保存到同一事务,保留关系文字和样式,支持撤销;落在空白处、原节点、自身或已有的同向连接上不修改关系线+- 选中关系线后,在底部设置中通过“箭头方向”选择正向箭头、反向箭头、双向箭头或无箭头;默认从连接起点指向终点,反向则从终点指向起点;切换时只改变箭头显示,保留连接节点、关系文字和手动路径,支持撤销和重做,不影响父子节点之间的树连线+- 选中关系线后,空心圆标出连接起点,实心圆标出连接终点,与箭头方向无关;拖动圆形手柄更换对应节点,可连接的节点会高亮;松手后重新计算路径并保存到同一事务,保留关系文字和样式,支持撤销;落在空白处、原节点、自身或已有的同向连接上不修改关系线;节点上的具体连接位置仍由系统自动选择,不支持自由拖动端点位置- 节点默认无背景、不显示边框,正文格式通过节点内的 Protyle 编辑;选中节点后,脑图面板底部显示单排配色工具栏,仅展示节点配色及颜色管理入口,复用外观面板中的文字色与背景色组合,包含内置及自定义颜色并遵循其顺序和可见性,可恢复默认色;点击树连线或关系线,在脑图面板底部显示对应的设置菜单,线条颜色复用外观背景色,菜单不显示标题栏、虚线及宽度控件;双击关系线文字,在原位置显示输入框进行编辑- 滚轮或触控板滚动用于移动画布,Ctrl + 滚轮或触控板双指捏合以鼠标位置为中心缩放;工具栏提供缩放、适应画布和全屏;全屏沿用编辑器的窗口内全屏及窗口控件避让,点击全屏按钮或按 Esc 退出并回到原列表位置- 选中范围首节点后点击工具栏的概要按钮,再点击末端同级节点,创建连续范围的方括号概要;范围不能跨层、重叠或嵌套,移动端使用相同的点选方式@@ -38,6 +39,8 @@关系线可选的 `route` 字段使用独立的 `version: 1`,`points` 保存不超过 64 个控制点。每个控制点的 `x`、`y` 是相对两个节点中心插值位置的偏移,`t` 是沿路径长度计算的插值比例(0 到 1),坐标偏移的绝对值不超过 1000000。缺少 `route` 表示自动路径;双击恢复时只删除该字段,保留文字、样式和端点。旧配置无需迁移,未知路径版本及损坏配置保留原值。节点位置变化时重新避障,暂时无法使用的手动路径仍保留配置并显示自动路径,恢复可用布局后重新使用手动路径。拖动期间的外部刷新取消预览,提交前核对关系线快照,避免覆盖较新的配置。+关系线的可选 `arrowDirection` 字段支持 `forward`、`reverse`、`both` 和 `none`,分别表示正向、反向、双向和无箭头;缺少该字段时沿用 `forward`,旧配置无需迁移。箭头方向与 `from`、`to` 端点及 `route` 路径独立,反向显示不交换端点或重置手动路径,端点手柄始终表示连接的起点和终点。只读、发布及思源格式的 HTML/PDF 预览按保存的方向显示箭头。+修改前补齐折叠隐藏的列表内容。结构、正文和配置修改通过已有文档事务保存,并进入文档撤销记录。复制列表时,样式所关联的节点 ID 和关系线的端点随复制后的块 ID 一起更新。版本 `1` 的元数据可选 `summaries` 数组保存概要,每项包含 `id`、所属父节点 `parentId`、按顺序排列的成员块 ID `nodeIds`、纯文本 `label` 和可选颜色 `color`。旧配置缺少该字段时表示没有概要,无需迁移;未知字段继续保留,损坏的概要配置不覆盖原值。括号坐标由布局派生,不持久化。转换为列表时保留该属性,转回脑图后恢复显示;概要文字不生成独立正文块,不参与正文全文搜索或块引用。diff --git a/kernel/model/transaction_list_mindmap.go b/kernel/model/transaction_list_mindmap.goindex 40fb8bd0c8..7032a174c5 100644--- a/kernel/model/transaction_list_mindmap.go+++ b/kernel/model/transaction_list_mindmap.go@@ -80,6 +80,12 @@ func validListMindmapMetadata(data map[string]any) bool {if _, ok := relation["label"].(string); !ok || seen[relation["id"].(string)] {return false}+ if value, exists := relation["arrowDirection"]; exists {+ direction, ok := value.(string)+ if !ok || !slices.Contains([]string{"forward", "reverse", "both", "none"}, direction) {+ return false+ }+ }if route, exists := relation["route"]; exists && !validListMindmapRoute(route) {return false}diff --git a/kernel/model/transaction_list_mindmap_test.go b/kernel/model/transaction_list_mindmap_test.goindex af3ef251bb..4289f5934c 100644--- a/kernel/model/transaction_list_mindmap_test.go+++ b/kernel/model/transaction_list_mindmap_test.go@@ -89,6 +89,30 @@ func TestPruneListMindmapPreservesInvalidRoutes(t *testing.T) {}}+func TestPruneListMindmapArrowDirections(t *testing.T) {+ for _, direction := range []string{"forward", "reverse", "both", "none"} {+ _, list, _ := mindmapTestTree()+ original := `{"version":1,"nodes":{"deleted":{}},"relations":[{"id":"r","from":"` + list.ID ++ `","to":"child","label":"Keep","arrowDirection":"` + direction ++ `","route":{"version":1,"points":[{"x":10,"y":20,"t":0.5}]},"extension":9007199254740993}]}`+ list.SetIALAttr(listMindmapMetadataAttr, original)+ next, changed := pruneListMindmapMetadata(list)+ if !changed || strings.Contains(next, "deleted") || !strings.Contains(next, `"arrowDirection":"`+direction+`"`) ||+ !strings.Contains(next, `"label":"Keep"`) || !strings.Contains(next, `"points":[{"x":10,"y":20,"t":0.5}]`) ||+ !strings.Contains(next, "9007199254740993") {+ t.Fatalf("arrow metadata was lost during pruning: %s", next)+ }+ }+ for _, direction := range []string{`null`, `""`, `"backward"`, `0`, `false`, `{}`, `[]`} {+ _, list, _ := mindmapTestTree()+ original := `{"version":1,"nodes":{"deleted":{}},"relations":[{"id":"r","from":"a","to":"b","label":"","arrowDirection":` + direction + `}]}`+ list.SetIALAttr(listMindmapMetadataAttr, original)+ if next, changed := pruneListMindmapMetadata(list); changed || next != original {+ t.Fatalf("invalid arrow direction was changed: %s", next)+ }+ }+}+func TestPruneListMindmapExcludesListsInsideContentBlocks(t *testing.T) {_, list, child := mindmapTestTree()quote := &ast.Node{Type: ast.NodeBlockquote, ID: "quote"}