An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Improve mind map summaries https://github.com/siyuan-note/siyuan/issues/20065
Danieldf430501133f
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.jsonindex 31dcb45f94..3f99860b04 100644--- a/app/appearance/langs/ar.json+++ b/app/appearance/langs/ar.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "إنشاء ${count} من الملخصات",+ "listMindmapSummaryConflict": "نطاقات الملخصات متقاطعة؛ يرجى تعديل التحديد","reAIOCR": "إعادة OCR باستخدام AI","pdfAnnotationDeleteRefConfirm": "يشير ${x} من الكتل إلى تعليق PDF هذا. سيؤدي حذفه إلى إبطال هذه المراجع. هل تريد المتابعة؟","ocrModelDefault": "القيمة الافتراضية للنموذج",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "يجب ألا يتجاوز حجم التعليمات 32 KiB","agentInstructionsConflict": "تم تغيير AGENTS.md. انسخ تعديلاتك، وأعد فتح المحرر، ثم ادمج التغييرات قبل الحفظ","listMindmapSummary": "ملخص",- "listMindmapSummarySelect": "حدد آخر عقدة شقيقة في نطاق الملخص؛ لا يمكن أن تتداخل الملخصات",+ "listMindmapSummarySelect": "حدد آخر عقدة لها الأب نفسه، أو اسحب في مساحة فارغة لتحديد مجموعات؛ اضغط على مساحة فارغة لتحديد العقد منفردة","mcpOAuthServer": "OAuth لخادم MCP","mcpOAuthTip": "يتطلب كلمة مرور قفل الشاشة أو تسجيل دخول OIDC وأصل HTTPS عامًا؛ يؤدي التعطيل أو تغيير الأصل إلى إلغاء جميع التفويضات","mcpOAuthPublicURL": "أصل HTTPS العام",diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.jsonindex 33ea603cae..a6fc94ce87 100644--- a/app/appearance/langs/de.json+++ b/app/appearance/langs/de.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "${count} Zusammenfassungen erstellen",+ "listMindmapSummaryConflict": "Zusammenfassungsbereiche überschneiden sich; Auswahl anpassen","reAIOCR": "OCR mit KI erneut ausführen","pdfAnnotationDeleteRefConfirm": "Diese PDF-Anmerkung wird von ${x} Blöcken referenziert. Durch das Löschen werden diese Referenzen ungültig. Fortfahren?","ocrModelDefault": "Modellstandard",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Anweisungen dürfen höchstens 32 KiB groß sein","agentInstructionsConflict": "AGENTS.md wurde geändert. Kopieren Sie Ihre Änderungen, öffnen Sie den Editor erneut und führen Sie die Änderungen vor dem Speichern zusammen","listMindmapSummary": "Zusammenfassung",- "listMindmapSummarySelect": "Wähle den letzten gleichgeordneten Knoten des Bereichs; Zusammenfassungen dürfen sich nicht überschneiden",+ "listMindmapSummarySelect": "Letzten Geschwisterknoten auswählen oder auf der leeren Zeichenfläche Gruppen aufziehen; zum einzelnen Auswählen von Knoten auf die leere Fläche tippen","mcpOAuthServer": "OAuth für MCP-Server","mcpOAuthTip": "Erfordert ein Sperrbildschirmpasswort oder eine OIDC-Anmeldung und einen öffentlichen HTTPS-Ursprung; Deaktivieren oder Ändern des Ursprungs widerruft alle Autorisierungen","mcpOAuthPublicURL": "Öffentlicher HTTPS-Ursprung",diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.jsonindex 24680273b2..bdc46bbbc6 100644--- a/app/appearance/langs/en.json+++ b/app/appearance/langs/en.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Create ${count} summaries",+ "listMindmapSummaryConflict": "Summary ranges cross; adjust the selection","reAIOCR": "Redo OCR with AI","pdfAnnotationDeleteRefConfirm": "This PDF annotation is referenced by ${x} blocks. Deleting it will invalidate these references. Continue?","ocrModelDefault": "Model default",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Instructions must be at most 32 KiB","agentInstructionsConflict": "AGENTS.md has changed. Copy your edits, reopen the editor, and merge them before saving","listMindmapSummary": "Summary",- "listMindmapSummarySelect": "Select the last sibling node in the summary range; summaries cannot overlap",+ "listMindmapSummarySelect": "Select the last sibling node, or drag on blank canvas to select groups; tap blank canvas to select nodes individually","mcpOAuthServer": "MCP server OAuth","mcpOAuthTip": "Requires a lock screen password or OIDC login and a public HTTPS origin; disabling or changing the origin revokes all authorizations","mcpOAuthPublicURL": "Public HTTPS origin",diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.jsonindex c2f2269cdb..cd473ff271 100644--- a/app/appearance/langs/es.json+++ b/app/appearance/langs/es.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Crear ${count} resúmenes",+ "listMindmapSummaryConflict": "Los rangos de resumen se cruzan; ajusta la selección","reAIOCR": "Repetir OCR con IA","pdfAnnotationDeleteRefConfirm": "${x} bloques hacen referencia a esta anotación PDF. Al eliminarla, estas referencias dejarán de ser válidas. ¿Continuar?","ocrModelDefault": "Predeterminado del modelo",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Las instrucciones no deben superar los 32 KiB","agentInstructionsConflict": "AGENTS.md ha cambiado. Copia tus cambios, vuelve a abrir el editor y combínalos antes de guardar","listMindmapSummary": "Resumen",- "listMindmapSummarySelect": "Selecciona el último nodo del mismo nivel del rango; los resúmenes no pueden superponerse",+ "listMindmapSummarySelect": "Selecciona el último nodo hermano o arrastra en el lienzo vacío para seleccionar grupos; toca el lienzo vacío para seleccionar nodos individualmente","mcpOAuthServer": "OAuth del servidor MCP","mcpOAuthTip": "Requiere una contraseña de bloqueo o inicio de sesión OIDC y un origen HTTPS público; desactivarlo o cambiar el origen revoca todas las autorizaciones","mcpOAuthPublicURL": "Origen HTTPS público",diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.jsonindex 4ae5e0fb64..257aea99ea 100644--- a/app/appearance/langs/fr.json+++ b/app/appearance/langs/fr.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Créer ${count} résumés",+ "listMindmapSummaryConflict": "Les plages de résumé se croisent ; ajustez la sélection","reAIOCR": "Relancer l’OCR avec l’IA","pdfAnnotationDeleteRefConfirm": "Cette annotation PDF est référencée par ${x} blocs. Sa suppression rendra ces références invalides. Continuer ?","ocrModelDefault": "Valeur par défaut du modèle",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Les instructions ne doivent pas dépasser 32 KiB","agentInstructionsConflict": "AGENTS.md a changé. Copiez vos modifications, rouvrez l’éditeur et fusionnez-les avant d’enregistrer","listMindmapSummary": "Résumé",- "listMindmapSummarySelect": "Sélectionnez le dernier nœud de même parent dans la plage ; les résumés ne peuvent pas se chevaucher",+ "listMindmapSummarySelect": "Sélectionnez le dernier nœud frère ou tracez une sélection dans une zone vide ; touchez une zone vide pour sélectionner les nœuds individuellement","mcpOAuthServer": "OAuth du serveur MCP","mcpOAuthTip": "Nécessite un mot de passe de verrouillage ou une connexion OIDC et une origine HTTPS publique ; désactiver ou modifier cette origine révoque toutes les autorisations","mcpOAuthPublicURL": "Origine HTTPS publique",diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.jsonindex 524285a369..e3630b9796 100644--- a/app/appearance/langs/he.json+++ b/app/appearance/langs/he.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "יצירת ${count} סיכומים",+ "listMindmapSummaryConflict": "טווחי הסיכומים מצטלבים; יש לשנות את הבחירה","reAIOCR": "ביצוע OCR מחדש עם AI","pdfAnnotationDeleteRefConfirm": "${x} בלוקים מפנים להערת PDF זו. מחיקתה תהפוך את ההפניות האלה ללא תקפות. להמשיך?","ocrModelDefault": "ברירת המחדל של המודל",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "גודל ההוראות לא יכול לעלות על 32 KiB","agentInstructionsConflict": "AGENTS.md השתנה. יש להעתיק את העריכות, לפתוח מחדש את העורך ולמזג את השינויים לפני השמירה","listMindmapSummary": "סיכום",- "listMindmapSummarySelect": "יש לבחור את הצומת האח האחרון בטווח הסיכום; סיכומים אינם יכולים לחפוף",+ "listMindmapSummarySelect": "בחרו את הצומת האחרון בעל אותו הורה, או גררו באזור ריק לבחירת קבוצות; הקישו באזור ריק לבחירת צמתים בנפרד","mcpOAuthServer": "OAuth של שרת MCP","mcpOAuthTip": "נדרשים סיסמת נעילת מסך או כניסת OIDC ומקור HTTPS ציבורי; השבתה או שינוי המקור מבטלים את כל ההרשאות","mcpOAuthPublicURL": "מקור HTTPS ציבורי",diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.jsonindex 9852b0f76a..20152eee64 100644--- a/app/appearance/langs/hi.json+++ b/app/appearance/langs/hi.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "${count} सारांश बनाएँ",+ "listMindmapSummaryConflict": "सारांश के दायरे एक-दूसरे को काटते हैं; चयन बदलें","reAIOCR": "AI से दोबारा OCR करें","pdfAnnotationDeleteRefConfirm": "${x} ब्लॉक इस PDF टिप्पणी का संदर्भ देते हैं। इसे हटाने से ये संदर्भ अमान्य हो जाएंगे। जारी रखें?","ocrModelDefault": "मॉडल का डिफ़ॉल्ट",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "निर्देश 32 KiB से अधिक नहीं होने चाहिए","agentInstructionsConflict": "AGENTS.md बदल गया है। अपने बदलाव कॉपी करें, संपादक फिर से खोलें और सहेजने से पहले बदलावों को मिलाएँ","listMindmapSummary": "सारांश",- "listMindmapSummarySelect": "सारांश के दायरे में समान मूल नोड वाला अंतिम नोड चुनें; सारांशों के दायरे आपस में नहीं मिलने चाहिए",+ "listMindmapSummarySelect": "एक ही मूल नोड का अंतिम नोड चुनें या खाली कैनवास पर खींचकर समूह चुनें; नोड अलग-अलग चुनने के लिए खाली कैनवास पर टैप करें","mcpOAuthServer": "MCP सर्वर OAuth","mcpOAuthTip": "लॉक स्क्रीन पासवर्ड या OIDC लॉगिन और सार्वजनिक HTTPS ओरिजिन आवश्यक है; बंद करने या ओरिजिन बदलने से सभी प्राधिकरण रद्द हो जाते हैं","mcpOAuthPublicURL": "सार्वजनिक HTTPS ओरिजिन",diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.jsonindex 2cc605da7a..c908a68644 100644--- a/app/appearance/langs/id.json+++ b/app/appearance/langs/id.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Buat ${count} ringkasan",+ "listMindmapSummaryConflict": "Rentang ringkasan saling bersilangan; sesuaikan pilihan","reAIOCR": "Ulangi OCR dengan AI","pdfAnnotationDeleteRefConfirm": "Anotasi PDF ini dirujuk oleh ${x} blok. Menghapusnya akan membuat rujukan tersebut tidak valid. Lanjutkan?","ocrModelDefault": "Bawaan model",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Instruksi tidak boleh melebihi 32 KiB","agentInstructionsConflict": "AGENTS.md telah berubah. Salin perubahan Anda, buka kembali editor, lalu gabungkan sebelum menyimpan","listMindmapSummary": "Ringkasan",- "listMindmapSummarySelect": "Pilih simpul terakhir dengan induk yang sama dalam rentang ringkasan; ringkasan tidak boleh tumpang tindih",+ "listMindmapSummarySelect": "Pilih simpul saudara terakhir atau seret pada kanvas kosong untuk memilih grup; ketuk kanvas kosong untuk memilih simpul satu per satu","mcpOAuthServer": "OAuth server MCP","mcpOAuthTip": "Memerlukan kata sandi layar kunci atau login OIDC dan origin HTTPS publik; menonaktifkan atau mengubah origin mencabut semua otorisasi","mcpOAuthPublicURL": "Origin HTTPS publik",diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.jsonindex 94c73b36d5..767724e382 100644--- a/app/appearance/langs/it.json+++ b/app/appearance/langs/it.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Crea ${count} riepiloghi",+ "listMindmapSummaryConflict": "Gli intervalli dei riepiloghi si incrociano; modifica la selezione","reAIOCR": "Ripeti OCR con IA","pdfAnnotationDeleteRefConfirm": "Questa annotazione PDF è referenziata da ${x} blocchi. Eliminandola, questi riferimenti diventeranno non validi. Continuare?","ocrModelDefault": "Predefinito del modello",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Le istruzioni non devono superare 32 KiB","agentInstructionsConflict": "AGENTS.md è cambiato. Copia le tue modifiche, riapri l’editor e uniscile prima di salvare","listMindmapSummary": "Riepilogo",- "listMindmapSummarySelect": "Seleziona l'ultimo nodo con lo stesso genitore nell'intervallo; i riepiloghi non possono sovrapporsi",+ "listMindmapSummarySelect": "Seleziona l'ultimo nodo fratello o trascina sullo spazio vuoto per selezionare gruppi; tocca lo spazio vuoto per selezionare i nodi singolarmente","mcpOAuthServer": "OAuth del server MCP","mcpOAuthTip": "Richiede una password di blocco o un accesso OIDC e un’origine HTTPS pubblica; disattivare o modificare l’origine revoca tutte le autorizzazioni","mcpOAuthPublicURL": "Origine HTTPS pubblica",diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.jsonindex 5cdad8e3af..db206032c9 100644--- a/app/appearance/langs/ja.json+++ b/app/appearance/langs/ja.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "${count} 個の要約を作成",+ "listMindmapSummaryConflict": "要約範囲が交差しています。選択を調整してください","reAIOCR": "AI で OCR を再実行","pdfAnnotationDeleteRefConfirm": "この PDF 注釈は ${x} 個のブロックから参照されています。削除すると、これらの参照が無効になります。続行しますか?","ocrModelDefault": "モデルの既定値",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "指示は 32 KiB 以下にしてください","agentInstructionsConflict": "AGENTS.md が変更されました。編集内容をコピーし、エディターを開き直して変更を統合してから保存してください","listMindmapSummary": "要約",- "listMindmapSummarySelect": "要約範囲の末端にある同じ親のノードを選択してください。要約範囲は重複できません",+ "listMindmapSummarySelect": "末端の兄弟ノードを選ぶか、キャンバスの空白部分をドラッグしてグループを選択します。空白部分をタップするとノードを個別に選択できます","mcpOAuthServer": "MCP サーバー OAuth","mcpOAuthTip": "画面ロックのパスワードまたは OIDC ログインと公開 HTTPS オリジンが必要です。無効化またはオリジンの変更で全認可が取り消されます","mcpOAuthPublicURL": "公開 HTTPS オリジン",diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.jsonindex f909569303..6722439a1c 100644--- a/app/appearance/langs/ko.json+++ b/app/appearance/langs/ko.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "요약 ${count}개 만들기",+ "listMindmapSummaryConflict": "요약 범위가 교차합니다. 선택을 조정하세요","reAIOCR": "AI로 OCR 다시 실행","pdfAnnotationDeleteRefConfirm": "이 PDF 주석은 ${x}개의 블록에서 참조됩니다. 삭제하면 이 참조가 무효화됩니다. 계속하시겠습니까?","ocrModelDefault": "모델 기본값",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "지침은 32 KiB를 초과할 수 없습니다","agentInstructionsConflict": "AGENTS.md가 변경되었습니다. 수정 내용을 복사한 다음 편집기를 다시 열고 변경 사항을 병합하여 저장하세요","listMindmapSummary": "요약",- "listMindmapSummarySelect": "요약 범위에서 부모가 같은 마지막 노드를 선택하세요. 요약 범위는 겹칠 수 없습니다",+ "listMindmapSummarySelect": "마지막 형제 노드를 선택하거나 빈 캔버스에서 드래그하여 그룹을 선택하세요. 빈 캔버스를 누르면 노드를 개별적으로 선택할 수 있습니다","mcpOAuthServer": "MCP 서버 OAuth","mcpOAuthTip": "화면 잠금 암호 또는 OIDC 로그인과 공개 HTTPS 출처가 필요하며, 비활성화하거나 출처를 변경하면 모든 승인이 취소됩니다","mcpOAuthPublicURL": "공개 HTTPS 출처",diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.jsonindex b18b418422..0bd8986804 100644--- a/app/appearance/langs/nl.json+++ b/app/appearance/langs/nl.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "${count} samenvattingen maken",+ "listMindmapSummaryConflict": "Samenvattingsbereiken kruisen elkaar; pas de selectie aan","reAIOCR": "OCR opnieuw uitvoeren met AI","pdfAnnotationDeleteRefConfirm": "${x} blokken verwijzen naar deze PDF-annotatie. Als u deze verwijdert, worden deze verwijzingen ongeldig. Doorgaan?","ocrModelDefault": "Modelstandaard",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Instructies mogen maximaal 32 KiB groot zijn","agentInstructionsConflict": "AGENTS.md is gewijzigd. Kopieer je wijzigingen, open de editor opnieuw en voeg ze samen voordat je opslaat","listMindmapSummary": "Samenvatting",- "listMindmapSummarySelect": "Selecteer de laatste knoop met dezelfde ouder in het bereik; samenvattingen mogen niet overlappen",+ "listMindmapSummarySelect": "Selecteer de laatste knoop met dezelfde ouder of sleep op het lege canvas om groepen te selecteren; tik op het lege canvas om knopen afzonderlijk te selecteren","mcpOAuthServer": "OAuth voor MCP-server","mcpOAuthTip": "Vereist een vergrendelwachtwoord of OIDC-aanmelding en een openbare HTTPS-oorsprong; uitschakelen of wijzigen van de oorsprong trekt alle machtigingen in","mcpOAuthPublicURL": "Openbare HTTPS-oorsprong",diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.jsonindex 02fcdffd3e..de5e976404 100644--- a/app/appearance/langs/pl.json+++ b/app/appearance/langs/pl.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Utwórz ${count} podsumowań",+ "listMindmapSummaryConflict": "Zakresy podsumowań krzyżują się; zmień zaznaczenie","reAIOCR": "Ponów OCR przy użyciu AI","pdfAnnotationDeleteRefConfirm": "Ta adnotacja PDF jest przywoływana przez ${x} bloków. Jej usunięcie unieważni te odwołania. Kontynuować?","ocrModelDefault": "Domyślna wartość modelu",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Instrukcje nie mogą przekraczać 32 KiB","agentInstructionsConflict": "Plik AGENTS.md został zmieniony. Skopiuj swoje zmiany, otwórz edytor ponownie i scal je przed zapisaniem","listMindmapSummary": "Podsumowanie",- "listMindmapSummarySelect": "Wybierz ostatni węzeł o tym samym rodzicu w zakresie; podsumowania nie mogą się nakładać",+ "listMindmapSummarySelect": "Wybierz ostatni węzeł z tym samym rodzicem lub przeciągnij po pustym obszarze, aby zaznaczyć grupy; dotknij pustego obszaru, aby wybierać węzły pojedynczo","mcpOAuthServer": "OAuth serwera MCP","mcpOAuthTip": "Wymaga hasła blokady lub logowania OIDC oraz publicznego adresu HTTPS; wyłączenie lub zmiana adresu cofa wszystkie autoryzacje","mcpOAuthPublicURL": "Publiczny adres HTTPS",diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.jsonindex e6268546d0..30e3b6d663 100644--- a/app/appearance/langs/pt-BR.json+++ b/app/appearance/langs/pt-BR.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Criar ${count} resumos",+ "listMindmapSummaryConflict": "Os intervalos dos resumos se cruzam; ajuste a seleção","reAIOCR": "Refazer OCR com IA","pdfAnnotationDeleteRefConfirm": "Esta anotação PDF é referenciada por ${x} blocos. Ao excluí-la, essas referências ficarão inválidas. Continuar?","ocrModelDefault": "Padrão do modelo",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "As instruções não podem exceder 32 KiB","agentInstructionsConflict": "AGENTS.md foi alterado. Copie suas alterações, reabra o editor e combine-as antes de salvar","listMindmapSummary": "Resumo",- "listMindmapSummarySelect": "Selecione o último nó com o mesmo pai no intervalo; os resumos não podem se sobrepor",+ "listMindmapSummarySelect": "Selecione o último nó irmão ou arraste na área vazia para selecionar grupos; toque na área vazia para selecionar nós individualmente","mcpOAuthServer": "OAuth do servidor MCP","mcpOAuthTip": "Exige uma senha de bloqueio ou login OIDC e uma origem HTTPS pública; desativar ou alterar a origem revoga todas as autorizações","mcpOAuthPublicURL": "Origem HTTPS pública",diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.jsonindex 50e86c639e..d9b8e0931c 100644--- a/app/appearance/langs/ru.json+++ b/app/appearance/langs/ru.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Создать сводки: ${count}",+ "listMindmapSummaryConflict": "Диапазоны сводок пересекаются; измените выделение","reAIOCR": "Повторить OCR с ИИ","pdfAnnotationDeleteRefConfirm": "На эту аннотацию PDF ссылаются ${x} блоков. После её удаления эти ссылки станут недействительными. Продолжить?","ocrModelDefault": "По умолчанию для модели",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Размер инструкций не должен превышать 32 KiB","agentInstructionsConflict": "AGENTS.md изменён. Скопируйте свои правки, заново откройте редактор и объедините изменения перед сохранением","listMindmapSummary": "Обобщение",- "listMindmapSummarySelect": "Выберите последний узел с тем же родителем в диапазоне; обобщения не могут пересекаться",+ "listMindmapSummarySelect": "Выберите последний узел с тем же родителем или выделите группы рамкой на пустом холсте; коснитесь пустого холста для выбора отдельных узлов","mcpOAuthServer": "OAuth сервера MCP","mcpOAuthTip": "Требуется пароль блокировки или вход через OIDC и публичный адрес HTTPS; отключение или изменение адреса отзывает все разрешения","mcpOAuthPublicURL": "Публичный адрес HTTPS",diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.jsonindex d8beb778ae..5b44b98e7c 100644--- a/app/appearance/langs/sk.json+++ b/app/appearance/langs/sk.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Vytvoriť ${count} súhrnov",+ "listMindmapSummaryConflict": "Rozsahy súhrnov sa krížia; upravte výber","reAIOCR": "Zopakovať OCR pomocou AI","pdfAnnotationDeleteRefConfirm": "Na túto anotáciu PDF odkazuje ${x} blokov. Jej odstránením sa tieto odkazy stanú neplatnými. Pokračovať?","ocrModelDefault": "Predvolená hodnota modelu",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Pokyny nesmú presiahnuť 32 KiB","agentInstructionsConflict": "Súbor AGENTS.md sa zmenil. Skopírujte svoje zmeny, znova otvorte editor a pred uložením ich zlúčte","listMindmapSummary": "Súhrn",- "listMindmapSummarySelect": "Vyberte posledný uzol s rovnakým rodičom v rozsahu; súhrny sa nesmú prekrývať",+ "listMindmapSummarySelect": "Vyberte posledný uzol s rovnakým rodičom alebo potiahnite na prázdnom plátne a vyberte skupiny; ťuknite na prázdne plátno a vyberajte uzly jednotlivo","mcpOAuthServer": "OAuth servera MCP","mcpOAuthTip": "Vyžaduje heslo uzamknutia alebo prihlásenie OIDC a verejný pôvod HTTPS; vypnutie alebo zmena pôvodu odvolá všetky autorizácie","mcpOAuthPublicURL": "Verejný pôvod HTTPS",diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.jsonindex edb80836d1..7fddc2afba 100644--- a/app/appearance/langs/sr.json+++ b/app/appearance/langs/sr.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Направи сажетке: ${count}",+ "listMindmapSummaryConflict": "Опсези сажетака се укрштају; прилагодите избор","reAIOCR": "Понови OCR помоћу AI","pdfAnnotationDeleteRefConfirm": "На ову PDF белешку упућује ${x} блокова. Брисањем ће ове референце постати неважеће. Наставити?","ocrModelDefault": "Подразумевана вредност модела",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Упутства не смеју бити већа од 32 KiB","agentInstructionsConflict": "AGENTS.md је промењен. Копирајте своје измене, поново отворите уређивач и обједините их пре чувања","listMindmapSummary": "Сажетак",- "listMindmapSummarySelect": "Изаберите последњи чвор са истим родитељем у опсегу; сажеци се не смеју преклапати",+ "listMindmapSummarySelect": "Изаберите последњи чвор са истим родитељем или превуците по празном платну да изаберете групе; додирните празно платно за појединачни избор чворова","mcpOAuthServer": "OAuth MCP сервера","mcpOAuthTip": "Захтева лозинку за закључавање или OIDC пријаву и јавну HTTPS адресу; искључивање или промена адресе опозива сва овлашћења","mcpOAuthPublicURL": "Јавна HTTPS адреса",diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.jsonindex bf6e7128ea..fa28499848 100644--- a/app/appearance/langs/th.json+++ b/app/appearance/langs/th.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "สร้างสรุป ${count} รายการ",+ "listMindmapSummaryConflict": "ช่วงสรุปไขว้กัน โปรดปรับการเลือก","reAIOCR": "ทำ OCR ใหม่ด้วย AI","pdfAnnotationDeleteRefConfirm": "มี ${x} บล็อกอ้างอิงคำอธิบายประกอบ PDF นี้ การลบจะทำให้การอ้างอิงเหล่านี้ใช้ไม่ได้ ต้องการดำเนินการต่อหรือไม่?","ocrModelDefault": "ค่าเริ่มต้นของโมเดล",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "คำสั่งต้องมีขนาดไม่เกิน 32 KiB","agentInstructionsConflict": "AGENTS.md มีการเปลี่ยนแปลง โปรดคัดลอกสิ่งที่คุณแก้ไข เปิดตัวแก้ไขอีกครั้ง แล้วรวมการเปลี่ยนแปลงก่อนบันทึก","listMindmapSummary": "สรุป",- "listMindmapSummarySelect": "เลือกโหนดสุดท้ายที่มีโหนดแม่เดียวกันในช่วงสรุป โดยช่วงสรุปต้องไม่ทับซ้อนกัน",+ "listMindmapSummarySelect": "เลือกโหนดสุดท้ายที่มีโหนดแม่เดียวกัน หรือลากบนพื้นที่ว่างเพื่อเลือกกลุ่ม แตะพื้นที่ว่างเพื่อเลือกโหนดทีละรายการ","mcpOAuthServer": "OAuth ของเซิร์ฟเวอร์ MCP","mcpOAuthTip": "ต้องมีรหัสผ่านล็อกหน้าจอหรือการเข้าสู่ระบบ OIDC และต้นทาง HTTPS สาธารณะ การปิดหรือเปลี่ยนต้นทางจะเพิกถอนการอนุญาตทั้งหมด","mcpOAuthPublicURL": "ต้นทาง HTTPS สาธารณะ",diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.jsonindex 9cb8c77010..1381485667 100644--- a/app/appearance/langs/tr.json+++ b/app/appearance/langs/tr.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "${count} özet oluştur",+ "listMindmapSummaryConflict": "Özet aralıkları kesişiyor; seçimi düzenleyin","reAIOCR": "OCR’yi yapay zekâ ile yeniden çalıştır","pdfAnnotationDeleteRefConfirm": "Bu PDF açıklamasına ${x} bloktan başvuruluyor. Silindiğinde bu başvurular geçersiz olacaktır. Devam edilsin mi?","ocrModelDefault": "Model varsayılanı",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Talimatlar 32 KiB boyutunu aşmamalıdır","agentInstructionsConflict": "AGENTS.md değişti. Düzenlemelerinizi kopyalayın, düzenleyiciyi yeniden açın ve kaydetmeden önce değişiklikleri birleştirin","listMindmapSummary": "Özet",- "listMindmapSummarySelect": "Özet aralığında aynı üst düğüme bağlı son düğümü seçin; özetler çakışamaz",+ "listMindmapSummarySelect": "Aynı üst öğeye bağlı son düğümü seçin veya boş tuvalde sürükleyerek grupları seçin; düğümleri tek tek seçmek için boş tuvale dokunun","mcpOAuthServer": "MCP sunucusu OAuth","mcpOAuthTip": "Ekran kilidi parolası veya OIDC oturumu ve herkese açık bir HTTPS kaynağı gerektirir; kapatmak veya kaynağı değiştirmek tüm yetkileri iptal eder","mcpOAuthPublicURL": "Herkese açık HTTPS kaynağı",diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.jsonindex 86ba3d4b8d..193fe39652 100644--- a/app/appearance/langs/uk.json+++ b/app/appearance/langs/uk.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "Створити підсумки: ${count}",+ "listMindmapSummaryConflict": "Діапазони підсумків перетинаються; змініть виділення","reAIOCR": "Повторити OCR за допомогою ШІ","pdfAnnotationDeleteRefConfirm": "На цю анотацію PDF посилаються ${x} блоків. Після її видалення ці посилання стануть недійсними. Продовжити?","ocrModelDefault": "Типове значення моделі",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "Розмір інструкцій не має перевищувати 32 KiB","agentInstructionsConflict": "AGENTS.md змінено. Скопіюйте свої правки, знову відкрийте редактор і об’єднайте зміни перед збереженням","listMindmapSummary": "Узагальнення",- "listMindmapSummarySelect": "Виберіть останній вузол зі спільним батьківським вузлом у діапазоні; узагальнення не можуть перетинатися",+ "listMindmapSummarySelect": "Виберіть останній вузол зі спільним батьком або виділіть групи рамкою на порожньому полотні; торкніться порожнього полотна для вибору окремих вузлів","mcpOAuthServer": "OAuth сервера MCP","mcpOAuthTip": "Потрібен пароль блокування або вхід через OIDC та публічна адреса HTTPS; вимкнення або зміна адреси відкликає всі дозволи","mcpOAuthPublicURL": "Публічна адреса HTTPS",diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.jsonindex b6610adab8..0b720709bb 100644--- a/app/appearance/langs/zh-CN.json+++ b/app/appearance/langs/zh-CN.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "创建 ${count} 个概要",+ "listMindmapSummaryConflict": "概要范围交叉,请调整选择","reAIOCR": "使用 AI 重新 OCR","pdfAnnotationDeleteRefConfirm": "此 PDF 标注被 ${x} 个块引用,删除后这些引用将失效。是否继续?","ocrModelDefault": "模型默认",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "指令内容不能超过 32 KiB","agentInstructionsConflict": "AGENTS.md 已发生变化。请先复制你的修改,重新打开编辑器并合并后再保存","listMindmapSummary": "概要",- "listMindmapSummarySelect": "选择概要范围的末端同级节点,范围不能与已有概要重叠",+ "listMindmapSummarySelect": "选择末端同级节点,或在画布空白处框选分组;点击空白处后可逐个点选节点","mcpOAuthServer": "MCP 服务端 OAuth","mcpOAuthTip": "需要锁屏密码或 OIDC 登录,以及公开的 HTTPS 地址;关闭或修改地址会撤销全部授权","mcpOAuthPublicURL": "公开 HTTPS 地址",diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.jsonindex 6e3d0cc225..e020e40a02 100644--- a/app/appearance/langs/zh-TW.json+++ b/app/appearance/langs/zh-TW.json@@ -1,4 +1,6 @@{+ "listMindmapSummaryBatch": "建立 ${count} 個概要",+ "listMindmapSummaryConflict": "概要範圍交叉,請調整選取範圍","reAIOCR": "使用 AI 重新 OCR","pdfAnnotationDeleteRefConfirm": "此 PDF 標註被 ${x} 個區塊引用,刪除後這些引用將失效。是否繼續?","ocrModelDefault": "模型預設",@@ -101,7 +103,7 @@"agentInstructionsTooLarge": "指令內容不能超過 32 KiB","agentInstructionsConflict": "AGENTS.md 已變更。請先複製你的修改,重新開啟編輯器並合併後再儲存","listMindmapSummary": "概要",- "listMindmapSummarySelect": "選擇概要範圍的末端同層節點,範圍不能與既有概要重疊",+ "listMindmapSummarySelect": "選擇末端同層節點,或在畫布空白處框選分組;點選空白處後可逐一選取節點","mcpOAuthServer": "MCP 伺服器 OAuth","mcpOAuthTip": "需要鎖定畫面密碼或 OIDC 登入,以及公開的 HTTPS 網址;停用或修改網址會撤銷全部授權","mcpOAuthPublicURL": "公開 HTTPS 網址",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 cce3b2a9cd..a2e012ad78 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@@ -2745,7 +2745,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 and cannot overlap or contain another summary. 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 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."}]},@@ -2773,7 +2773,7 @@"Children": [{"Type": "NodeText",- "Data": "Converting to a list hides the summary but preserves its data; converting back restores it. Nodes inserted inside the range are included automatically. Removing or moving members out shrinks the range; one remaining member keeps the summary, while removing all members removes it. Summary text is an annotation, not an independently searchable or referenceable block. SiYuan-format HTML and PDF previews display summaries."+ "Data": "Converting to a list hides the summary but preserves its data; converting back restores it. Nodes inserted inside the range are included automatically. Removing or moving members out shrinks the range; one remaining member keeps the summary, while removing all members removes it. Summary text is an annotation, not an independently searchable or referenceable block. SiYuan-format HTML and PDF previews display summaries. Deleting an inner summary preserves the nodes and the outer summary. Nested configurations require a newer client; older clients preserve the configuration and display the source list instead of the mind map."}]},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 e5db15a42f..5be0169d70 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@@ -13458,7 +13458,7 @@"Children": [{"Type": "NodeText",- "Data": "While selecting a summary range, use the up and down arrow keys to select the last sibling node, Enter to confirm, and Esc to cancel. While editing summary text, Enter saves and Esc cancels. Delete or Backspace removes the selected summary."+ "Data": "In the summary batch preview, Enter creates all groups in one undoable operation and Esc cancels. While selecting a summary range, use the up and down arrow keys to select the last sibling node, Enter to confirm, and Esc to cancel. While editing summary text, Enter saves and Esc cancels. Delete or Backspace removes the selected summary."}]},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 49557fe8d4..a105ea0b5c 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@@ -2824,7 +2824,7 @@},{"Type": "NodeText",- "Data": ",再选择末端同级节点,即可添加方括号和概要文字。范围必须连续,不能与已有概要重叠或嵌套。移动端也可按相同步骤操作。选择范围时也可使用上下方向键选择末端节点,Enter 确认范围,Esc 取消。"+ "Data": ",再选择末端同级节点,即可添加方括号和概要文字。范围必须连续,支持单节点概要和范围嵌套,范围可以相互包含,但不能交叉。括号包围可见子树及内层概要。批量创建时,点击概要按钮后在画布空白处框选;也可以先点击空白处,再逐个点选节点。预览按父节点和连续范围分组,父子同时选中时以最外层节点为准。已有相同概要会跳过,交叉范围会阻止创建。点击确认按钮或按 Enter 一次创建全部预览概要,并可一次撤销;Esc 取消。文档更新会取消待确认的选择。移动端也可按相同步骤操作。选择范围时也可使用上下方向键选择末端节点,Enter 确认范围,Esc 取消。"}]},@@ -2852,7 +2852,7 @@"Children": [{"Type": "NodeText",- "Data": "转成列表后,概要隐藏但数据保留,转回脑图后恢复显示。范围内插入的节点自动纳入概要,删除成员或将成员移出范围会缩小范围;剩一个成员仍保留概要,全部删除时一并删除概要。概要文字属于附加说明,不作为可独立搜索或引用的正文块。思源格式的 HTML 和 PDF 预览会显示概要。"+ "Data": "转成列表后,概要隐藏但数据保留,转回脑图后恢复显示。范围内插入的节点自动纳入概要,删除成员或将成员移出范围会缩小范围;剩一个成员仍保留概要,全部删除时一并删除概要。概要文字属于附加说明,不作为可独立搜索或引用的正文块。思源格式的 HTML 和 PDF 预览会显示概要。 删除内层概要会保留节点和外层概要。嵌套配置需要新版客户端,旧客户端会保留配置并显示源列表。"}]},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 d8912cd5c8..4025e3d18b 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@@ -13540,7 +13540,7 @@"Children": [{"Type": "NodeText",- "Data": "选择概要范围时,使用上下方向键选择末端同级节点,Enter 确认,Esc 取消。编辑概要文字时,Enter 保存,Esc 取消。选中概要后,Delete 或 Backspace 删除概要。"+ "Data": "批量概要预览中,Enter 一次创建所有分组概要,Esc 取消,创建后可一次撤销。选择概要范围时,使用上下方向键选择末端同级节点,Enter 确认,Esc 取消。编辑概要文字时,Enter 保存,Esc 取消。选中概要后,Delete 或 Backspace 删除概要。"}]},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 15f7e4c6a4..cdbada0837 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@@ -2760,7 +2760,7 @@},{"Type": "NodeText",- "Data": ",再選擇末端同層節點,即可新增方括號與概要文字。範圍必須連續,不能與既有概要重疊或巢狀包含。行動端也可依相同步驟操作。選擇範圍時也可使用上下方向鍵選擇末端節點,Enter 確認範圍,Esc 取消。"+ "Data": ",再選擇末端同層節點,即可新增方括號與概要文字。範圍必須連續,支援單節點概要和範圍巢狀包含,範圍可以相互包含,但不能交叉。括號包圍可見子樹及內層概要。批次建立時,點選概要按鈕後在畫布空白處框選;也可以先點選空白處,再逐一選取節點。預覽依父節點和連續範圍分組,同時選取父子節點時以最外層節點為準。既有相同概要會略過,交叉範圍會阻止建立。點選確認按鈕或按 Enter 一次建立全部預覽概要,並可一次復原;Esc 取消。文件更新會取消待確認的選取範圍。行動端也可依相同步驟操作。選擇範圍時也可使用上下方向鍵選擇末端節點,Enter 確認範圍,Esc 取消。"}]},@@ -2788,7 +2788,7 @@"Children": [{"Type": "NodeText",- "Data": "轉成列表後,概要隱藏但資料保留,轉回心智圖後恢復顯示。範圍內插入的節點自動納入概要,刪除成員或將成員移出範圍會縮小範圍;剩一個成員仍保留概要,全部刪除時一併刪除概要。概要文字屬於附加說明,不作為可獨立搜尋或引用的正文區塊。思源格式的 HTML 與 PDF 預覽會顯示概要。"+ "Data": "轉成列表後,概要隱藏但資料保留,轉回心智圖後恢復顯示。範圍內插入的節點自動納入概要,刪除成員或將成員移出範圍會縮小範圍;剩一個成員仍保留概要,全部刪除時一併刪除概要。概要文字屬於附加說明,不作為可獨立搜尋或引用的正文區塊。思源格式的 HTML 與 PDF 預覽會顯示概要。 刪除內層概要會保留節點和外層概要。巢狀配置需要新版用戶端,舊版用戶端會保留配置並顯示來源列表。"}]},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 059a062de8..d690b484fe 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@@ -13458,7 +13458,7 @@"Children": [{"Type": "NodeText",- "Data": "選擇概要範圍時,使用上下方向鍵選擇末端同層節點,Enter 確認,Esc 取消。編輯概要文字時,Enter 儲存,Esc 取消。選取概要後,Delete 或 Backspace 刪除概要。"+ "Data": "批次概要預覽中,Enter 一次建立所有分組概要,Esc 取消,建立後可一次復原。選擇概要範圍時,使用上下方向鍵選擇末端同層節點,Enter 確認,Esc 取消。編輯概要文字時,Enter 儲存,Esc 取消。選取概要後,Delete 或 Backspace 刪除概要。"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.syindex f48159cf05..2dfe938451 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@@ -13412,7 +13412,7 @@"Children": [{"Type": "NodeText",- "Data": "要約範囲の選択中は上下の矢印キーで同じ親を持つ末端のノードを選び、Enter で確定、Esc でキャンセルします。要約テキストの編集中は Enter で保存、Esc でキャンセルします。選択中の要約は Delete または Backspace で削除できます。"+ "Data": "要約の一括作成プレビューでは Enter で全グループを作成し、Esc でキャンセルします。作成は一度の取り消しで元に戻せます。要約範囲の選択中は上下の矢印キーで同じ親を持つ末端のノードを選び、Enter で確定、Esc でキャンセルします。要約テキストの編集中は Enter で保存、Esc でキャンセルします。選択中の要約は Delete または Backspace で削除できます。"}]},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 820d9e1556..0a09518a6c 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@@ -2911,7 +2911,7 @@},{"Type": "NodeText",- "Data": " をクリックしてから、同じ親を持つ末端のノードを選択すると、角括弧と要約テキストを追加できます。範囲は連続している必要があり、既存の要約と重複したり、入れ子にしたりすることはできません。モバイルでも同じ手順で操作できます。範囲の選択中は上下の矢印キーで末端のノードを選び、Enter で範囲を確定し、Esc でキャンセルすることもできます。"+ "Data": " をクリックしてから、同じ親を持つ末端のノードを選択すると、角括弧と要約テキストを追加できます。範囲は連続している必要があります。単一ノードの要約と範囲の入れ子に対応し、包含関係は許可されますが、交差する範囲は作成できません。括弧は表示中の子ツリーと内側の要約を囲みます。一括作成するには要約ボタンを押してキャンバスの空白部分をドラッグします。空白部分をタップしてからノードを個別に選択することもできます。プレビューでは同じ親を持つ連続したノードをグループ化し、親子が同時に選択された場合は最も外側のノードを優先します。同じ要約は重複して作成せず、交差する範囲がある場合は作成を止めます。確認ボタンまたは Enter で全グループを一度に作成し、一度の取り消しで元に戻せます。Esc でキャンセルします。文書が更新されると保留中の選択はキャンセルされます。モバイルでも同じ手順で操作できます。範囲の選択中は上下の矢印キーで末端のノードを選び、Enter で範囲を確定し、Esc でキャンセルすることもできます。"}]},@@ -2939,7 +2939,7 @@"Children": [{"Type": "NodeText",- "Data": "リストに変換すると要約は非表示になりますが、データは保持され、マインドマップに戻すと再表示されます。範囲内に挿入したノードは自動的に含まれます。ノードを削除したり範囲外に移動したりすると範囲が縮まり、1 つ残っていれば要約を保持し、すべて削除すると要約も削除します。要約テキストは注釈であり、個別に検索や参照ができる本文ブロックではありません。SiYuan 形式の HTML と PDF プレビューには要約が表示されます。"+ "Data": "リストに変換すると要約は非表示になりますが、データは保持され、マインドマップに戻すと再表示されます。範囲内に挿入したノードは自動的に含まれます。ノードを削除したり範囲外に移動したりすると範囲が縮まり、1 つ残っていれば要約を保持し、すべて削除すると要約も削除します。要約テキストは注釈であり、個別に検索や参照ができる本文ブロックではありません。SiYuan 形式の HTML と PDF プレビューには要約が表示されます。内側の要約を削除してもノードと外側の要約は残ります。入れ子の設定には新しいクライアントが必要です。古いクライアントは設定を保持し、元のリストを表示します。"}]},diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scssindex e71f37c120..e92eb28ce5 100644--- a/app/src/assets/scss/protyle/_mindmap-view.scss+++ b/app/src/assets/scss/protyle/_mindmap-view.scss@@ -209,6 +209,36 @@pointer-events: none;}+ &__viewport--summary {+ cursor: crosshair;+ }++ &__selection-box {+ position: absolute;+ pointer-events: none;+ border: 1px solid var(--b3-theme-primary);+ background: var(--b3-theme-primary-lightest);+ box-sizing: border-box;+ z-index: 5;+ }++ &__summary-controls {+ display: flex;+ align-items: center;+ flex-wrap: wrap;+ gap: 8px;++ > span {+ flex: 1 1 120px;+ min-width: 0;+ overflow-wrap: anywhere;+ }++ > button {+ flex-shrink: 0;+ }+ }+&__viewport--pan {cursor: grab;@@ -856,6 +886,7 @@&__tooltip,&__route-handle,&__route-status,+ &__selection-box,&__add-bridge,&__fold,&__add-child {diff --git a/app/src/protyle/render/listMindmap/anchorsView.test.ts b/app/src/protyle/render/listMindmap/anchorsView.test.tsindex 0be06df745..e0977749ea 100644--- a/app/src/protyle/render/listMindmap/anchorsView.test.ts+++ b/app/src/protyle/render/listMindmap/anchorsView.test.ts@@ -41,6 +41,7 @@ const setup = (overrides: Partial<ListMindmapRelation> = {}) => {routingObstacles: () => [...positions.values()], draw: () => {}, refreshLayout: () => {},clearDrop: () => {}, setHoveredLine: () => {}, finishThen: (action: () => void) => action(),routeHandles: new Map(), routeStatus: {}, label: (key: string) => key,+ summaryBox: {hidden: true},getRouteHandle: () => ({style: {}}),});view.relationRoutes.set("r", view.calculateRelationRoute(relation, positions.get("a"), positions.get("b")));diff --git a/app/src/protyle/render/listMindmap/index.ts b/app/src/protyle/render/listMindmap/index.tsindex 2271480808..a078a41684 100644--- a/app/src/protyle/render/listMindmap/index.ts+++ b/app/src/protyle/render/listMindmap/index.ts@@ -42,7 +42,8 @@ import {openListMindmapEditor} from "./editor";import {focusListMindmap} from "./create";import {getListMindmapFoldStates, getListMindmapSiblingFoldStates} from "./fold";import {isMobile} from "../../../util/functions";-import {getListMindmapSiblingIDs, getListMindmapSummaryRange} from "./summary";+import {addListMindmapSummaryRanges, getListMindmapSiblingIDs, getListMindmapSummaryParentID, getListMindmapSummaryRange,+ getListMindmapSummarySnapshot} from "./summary";import {isProtyleListItemFragment} from "../../runtimeCapabilities";import {isFoldedRenderContent} from "../foldedContent";@@ -393,19 +394,38 @@ class ListMindmapController {metadata.relations = metadata.relations.filter(item => item.id !== id);}),onSummaryAdd: async (from, to) => {- const id = Lute.NewNodeID();+ let ids: string[];const saved = await this.change(() => {const model = readListMindmap(list);const nodeIds = getListMindmapSummaryRange(model, from, to);if (!nodeIds.length) {return false;}- model.metadata.summaries ||= [];- model.metadata.summaries.push({id, parentId: model.nodes.get(from).parentId,- nodeIds, label: window.siyuan.languages.listMindmapSummary});+ ids = addListMindmapSummaryRanges(model, [{parentId: getListMindmapSummaryParentID(model, from), nodeIds}],+ () => Lute.NewNodeID(), window.siyuan.languages.listMindmapSummary);+ if (!ids) {+ return false;+ }+ writeListMindmapMetadata(list, model.metadata);+ });+ return saved ? ids?.[0] : undefined;+ },+ onSummaryBatchAdd: async (ranges, expected) => {+ let ids: string[];+ const saved = await this.change(() => {+ const model = readListMindmap(list);+ if (getListMindmapSummarySnapshot(model) !== expected) {+ showMessage(window.siyuan.languages.listMindmapStale);+ return false;+ }+ ids = addListMindmapSummaryRanges(model, ranges, () => Lute.NewNodeID(),+ window.siyuan.languages.listMindmapSummary);+ if (!ids) {+ return false;+ }writeListMindmapMetadata(list, model.metadata);});- return saved ? id : undefined;+ return saved ? ids : undefined;},onSummaryChange: (id, patch, expected) => this.metadata(metadata => {const summary = metadata.summaries?.find(item => item.id === id);diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex 01278bdc48..bb3ddb1d5d 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -42,7 +42,7 @@ test("mindmap metadata rejects unknown formats and invalid values without replac'"relations":[{"id":"r","from":"a","to":"b","label":"label","dash":true}],"extension":42}';assert.equal(JSON.stringify(parseListMindmapMetadata(value)), value);assert.deepEqual(parseListMindmapMetadata(null).relations, []);- for (const invalid of ["", "null", "[]", "{", '{"version":2,"nodes":{},"relations":[]}',+ for (const invalid of ["", "null", "[]", "{", '{"version":3,"nodes":{},"relations":[]}','{"version":1,"nodes":{"a":{"fontSize":"18"}},"relations":[]}','{"version":1,"nodes":{"a":{"lineWidth":-1}},"relations":[]}','{"version":1,"nodes":{},"relations":[],"viewLocked":"true"}',@@ -96,6 +96,20 @@ test("summary metadata is optional and rejects damaged groups while retaining ex}});+test("versioned nested summaries retain legacy fixtures and reject crossing or damaged configurations", () => {+ const fixture = readFileSync(path.resolve(__dirname, "../../../../../kernel/model/testdata/list_mindmap_summary_v1.json"), "utf8").trim();+ assert.equal(JSON.stringify(parseListMindmapMetadata(fixture)), fixture);+ const data = JSON.parse(fixture);+ data.summaries.push({...data.summaries[0], id: "inner", nodeIds: ["a"]});+ assert.throws(() => parseListMindmapMetadata(JSON.stringify(data)), /Invalid list mindmap metadata/);+ data.version = 2;+ assert.equal(JSON.stringify(parseListMindmapMetadata(JSON.stringify(data))), JSON.stringify(data));+ for (const nodes of [["b", "c"], ["a", "a"]]) {+ data.summaries[1].nodeIds = nodes;+ assert.throws(() => parseListMindmapMetadata(JSON.stringify(data)), /Invalid list mindmap metadata/);+ }+});+test("large summary labels reserve space on both sides of the group", () => {const root = measured("root", 100, 40, [measured("before"), measured("a"), measured("b"), measured("after")]);const {nodes} = layoutListMindmap(root, {summaries: [{nodeIds: ["a", "b"], height: 500}]});@@ -167,6 +181,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,const api = new Function("mathRender", "Constants", "highlightRender", sourceCode + "; return {readListMindmap, moveListMindmapNode, addListMindmapNode, " +"deleteListMindmapNode, replaceListMindmapContent, cleanListMindmapHTML, convertListMindmapToList, listMindmapConversionSource, remapListMindmapIDs, writeListMindmapMetadata, retagMindmapBranch, " +"getListMindmapSiblingIDs, normalizeListMindmapSummaryMetadata, getListMindmapSummaryRange, getListMindmapSiblingFoldStates, " ++ "addListMindmapSummaryRanges, getListMindmapSummarySnapshot, " +"normalizeLegacyMindmapCodes, replaceLegacyMindmapHTML, spinListMindmapDOM, focusListMindmap, " +"tabsRender, destroyTabsRender, getTabTask, getListMindmapTabItem, convertTabsList, ListMindmapView, registerListMindmapView, resolveVisibleListMindmapBlock, getListMindmapElements, registerListMindmapRoot, restoreListMindmapFocus};")(async (element: Element) => {@@ -555,7 +570,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(inserted.dataset.marker, "1.");// 未知版本或损坏配置在任何编辑之前报错,原内容保持不变。- list.setAttribute("custom-sy-list-mindmap-data", '{"version":2,"nodes":{},"relations":[]}');+ list.setAttribute("custom-sy-list-mindmap-data", '{"version":3,"nodes":{},"relations":[]}');const corrupt = list.outerHTML;check.throws(() => api.moveListMindmapNode(list, inserted.dataset.nodeId, first.id, "after"), /metadata/);check.throws(() => api.deleteListMindmapNode(list, inserted.dataset.nodeId), /metadata/);@@ -776,7 +791,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,copiedItems[0].setAttribute("data-node-id", "new-a");copiedItems[1].setAttribute("data-node-id", "new-b");const child = list.querySelector('[data-type="NodeList"]');- child.setAttribute("custom-sy-list-mindmap-data", '{"version":2,"nodes":{},"relations":[]}');+ child.setAttribute("custom-sy-list-mindmap-data", '{"version":3,"nodes":{},"relations":[]}');const beforeRemap = list.outerHTML;check.throws(() => api.remapListMindmapIDs(list, new Map([["a", "new-a"], ["b", "new-b"]])), /metadata/);check.equal(list.outerHTML, beforeRemap);@@ -3260,15 +3275,12 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,const bracketCenter = summaryViewport.getBoundingClientRect().top + summaryView.offsetY +(summaryPosition.top + summaryPosition.bottom) / 2 * summaryView.scale;check.ok(Math.abs((summaryBounds.top + summaryBounds.bottom) / 2 - bracketCenter) < 1);- const memberCenters = [summaryIds[0], summaryIds[2]].map(id => {- const rect = summaryHost.querySelector(`[data-mindmap-id="${id}"]`).getBoundingClientRect();- return (rect.top + rect.bottom) / 2;- });+ const memberBounds = [...summaryView.positions.values()].filter((position: {id: string}) => position.id !== summaryModel.root.id)+ .map((position: {id: string}) => summaryHost.querySelector(`[data-mindmap-id="${position.id}"]`).getBoundingClientRect());const summaryOriginY = summaryViewport.getBoundingClientRect().top + summaryView.offsetY;- check.ok(Math.abs(summaryOriginY + summaryPosition.top * summaryView.scale - memberCenters[0]) < 1);- check.ok(Math.abs(summaryOriginY + summaryPosition.bottom * summaryView.scale - memberCenters[1]) < 1);- check.ok(Math.abs((memberCenters[0] + memberCenters[1]) / 2 - bracketCenter) < 1,- "summary brackets connect the displayed first and last member centers");+ check.ok(summaryOriginY + summaryPosition.top * summaryView.scale < Math.min(...memberBounds.map(rect => rect.top)));+ check.ok(summaryOriginY + summaryPosition.bottom * summaryView.scale > Math.max(...memberBounds.map(rect => rect.bottom)),+ "summary brackets enclose all visible descendants");summaryView.clearSelection();summaryLabel.focus();check.equal(document.activeElement, summaryLabel);@@ -3434,6 +3446,168 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.deepEqual(api.readListMindmap(summaryList).metadata.summaries[0].nodeIds, [summaryIds[2]]);api.deleteListMindmapNode(summaryList, summaryIds[2]);check.deepEqual(api.readListMindmap(summaryList).metadata.summaries, []);++ // 多层概要在折叠、复制、列表往返和窄幅打印中保留成员与内外层边界。+ {+ const nestedList = reset("- Root\n - First\n - A\n - B\n - Second\n - Third\n");+ const nestedModel = api.readListMindmap(nestedList);+ const nestedFirst = nestedModel.root.children[0];+ const nestedRanges = [+ {parentId: nestedList.dataset.nodeId, nodeIds: [nestedModel.root.id]},+ {parentId: nestedModel.root.id, nodeIds: nestedModel.root.children.slice(0, 2).map((node: ListMindmapNode) => node.id)},+ {parentId: nestedModel.root.id, nodeIds: [nestedFirst.id]},+ {parentId: nestedFirst.id, nodeIds: nestedFirst.children.map((node: ListMindmapNode) => node.id)},+ ];+ let nestedID = 0;+ check.deepEqual(api.addListMindmapSummaryRanges(nestedModel, nestedRanges, () => `nested-${++nestedID}`,+ "Nested summary ".repeat(20)), ["nested-1", "nested-2", "nested-3", "nested-4"]);+ check.equal(nestedModel.metadata.version, 2);+ api.writeListMindmapMetadata(nestedList, nestedModel.metadata);+ const nestedHost = document.createElement("div");+ nestedHost.style.width = "900px";+ nestedHost.style.fontSize = "32px";+ document.body.append(nestedHost);+ let nestedView = new api.ListMindmapView({host: nestedHost, model: api.readListMindmap(nestedList), onExit: () => {}});+ await settle();+ const checkNestedBounds = () => {+ ["nested-1", "nested-2", "nested-3"].forEach((id, index) => {+ const outer = nestedView.summaryPositions.get(id);+ const inner = nestedView.summaryPositions.get(`nested-${index + 2}`);+ check.ok(outer.x > inner.labelX + inner.width, `${id} encloses the inner label horizontally`);+ check.ok(outer.top < inner.top && outer.top < inner.labelY);+ check.ok(outer.bottom > inner.bottom && outer.bottom > inner.labelY + inner.height);+ });+ const inner = nestedView.summaryPositions.get("nested-3");+ const next = nestedView.positions.get(nestedModel.root.children[1].id);+ check.ok(inner.labelY + inner.height < next.y, "tall inner labels do not overlap the next sibling branch");+ };+ checkNestedBounds();+ const expandedOuterX = nestedView.summaryPositions.get("nested-2").x;+ nestedFirst.children.forEach((node: ListMindmapNode) => check.ok(nestedView.positions.has(node.id)));+ nestedModel.nodes.get(nestedFirst.id).element.setAttribute("fold", "1");+ nestedView.update(api.readListMindmap(nestedList));+ await settle();+ check.equal(nestedView.summaryPositions.has("nested-4"), false);+ check.ok(nestedView.summaryPositions.get("nested-2").x < expandedOuterX);+ nestedModel.nodes.get(nestedFirst.id).element.removeAttribute("fold");+ nestedView.update(api.readListMindmap(nestedList));+ await settle();+ checkNestedBounds();+ const nestedCopy = nestedList.cloneNode(true) as HTMLElement;+ const nestedCopiedIDs = new Map<string, string>();+ [nestedCopy, ...Array.from(nestedCopy.querySelectorAll<HTMLElement>("[data-node-id]"))].forEach(element => {+ const id = Lute.NewNodeID();+ nestedCopiedIDs.set(element.dataset.nodeId, id);+ element.dataset.nodeId = id;+ });+ api.remapListMindmapIDs(nestedCopy, nestedCopiedIDs);+ check.deepEqual(api.readListMindmap(nestedCopy).metadata.summaries.map((entry: {nodeIds: string[]}) => entry.nodeIds),+ nestedRanges.map(range => range.nodeIds.map((id: string) => nestedCopiedIDs.get(id))));+ api.retagMindmapBranch(nestedList, true);+ const nestedConverted = document.createElement("div");+ nestedConverted.innerHTML = api.convertListMindmapToList(nestedList, "UL2OL", lute);+ check.deepEqual(api.readListMindmap(nestedConverted.firstElementChild).metadata.summaries, nestedModel.metadata.summaries);+ nestedView.destroy();+ nestedHost.style.width = "280px";+ nestedView = new api.ListMindmapView({host: nestedHost, model: api.readListMindmap(nestedList),+ readOnly: true, printLayout: true, onExit: () => {}});+ await settle();+ const nestedPrintBounds = nestedHost.querySelector(".mindmap-view__viewport").getBoundingClientRect();+ nestedHost.querySelectorAll(".mindmap-view__summary").forEach(label => {+ const rect = label.getBoundingClientRect();+ check.ok(rect.left >= nestedPrintBounds.left - 1 && rect.right <= nestedPrintBounds.right + 1);+ check.ok(rect.top >= nestedPrintBounds.top - 1 && rect.bottom <= nestedPrintBounds.bottom + 1);+ });+ check.equal(api.readListMindmap(nestedList).metadata.version, 2);+ nestedView.destroy();+ nestedHost.remove();+ }++ const batchList = reset("- Root\n - First\n - A\n - B\n - Second\n - C\n - D\n");+ const batchHost = document.createElement("div");+ batchHost.style.width = "700px";+ document.body.append(batchHost);+ const batchHistory: {before: string, after: string}[] = [];+ let batchID = 0;+ const batchView = new api.ListMindmapView({host: batchHost, model: api.readListMindmap(batchList), onExit: () => {},+ labels: new Proxy({}, {get: (_target, key) => String(key)}),+ onSummaryBatchAdd: async (ranges: any[], expected: string) => {+ const model = api.readListMindmap(batchList);+ check.equal(api.getListMindmapSummarySnapshot(model), expected);+ const before = batchList.outerHTML;+ const added = api.addListMindmapSummaryRanges(model, ranges, () => `batch-${++batchID}`, "Summary");+ check.ok(added);+ api.writeListMindmapMetadata(batchList, model.metadata);+ batchHistory.push({before, after: batchList.outerHTML});+ batchView.update(api.readListMindmap(batchList));+ return added;+ }});+ await settle();+ const batchButton = batchHost.querySelector<HTMLButtonElement>('[aria-label="listMindmapSummary"]');+ const batchViewport = batchHost.querySelector<HTMLElement>(".mindmap-view__viewport");+ batchView.clearSelection();+ check.equal(batchButton.disabled, false, "batch selection can start without choosing a parent");+ batchButton.click();+ const batchModel = api.readListMindmap(batchList);+ const leafIDs = batchModel.root.children.flatMap((node: ListMindmapNode) => node.children.map(child => child.id));+ const leafRects = leafIDs.map((id: string) => batchHost.querySelector(`[data-mindmap-id="${id}"]`).getBoundingClientRect());+ const left = Math.min(...leafRects.map((rect: DOMRect) => rect.left)) - 1;+ const top = Math.min(...leafRects.map((rect: DOMRect) => rect.top)) - 1;+ const right = Math.max(...leafRects.map((rect: DOMRect) => rect.right)) + 1;+ const bottom = Math.max(...leafRects.map((rect: DOMRect) => rect.bottom)) + 1;+ sendPointer(batchViewport, "pointerdown", left, top);+ sendPointer(batchViewport, "pointermove", right, bottom);+ sendPointer(batchViewport, "pointerup", right, bottom);+ check.equal(batchView.summaryRanges.length, 2);+ check.equal(batchHistory.length, 0, "dragging only previews the groups");+ check.equal(batchHost.querySelector<HTMLElement>(".mindmap-view__summary-controls").hidden, false);+ batchHost.style.width = "280px";+ batchHost.style.fontSize = "32px";+ await settle();+ const controls = batchHost.querySelector<HTMLElement>(".mindmap-view__summary-controls");+ const controlsBounds = controls.getBoundingClientRect();+ check.ok(controlsBounds.width <= batchHost.offsetWidth - 16);+ controls.querySelectorAll("button").forEach(button => {+ const rect = button.getBoundingClientRect();+ check.ok(rect.left >= controlsBounds.left && rect.right <= controlsBounds.right);+ check.ok(rect.top >= controlsBounds.top && rect.bottom <= controlsBounds.bottom);+ check.ok(button.classList.contains("b3-button"));+ });+ batchHost.style.width = "700px";+ batchHost.style.fontSize = "";+ await settle();+ batchHost.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter", bubbles: true}));+ await settle();+ check.equal(batchHistory.length, 1, "all groups use a single submission");+ check.equal(api.readListMindmap(batchList).metadata.summaries.length, 2);+ const restoreBatch = (html: string) => {+ const restored = document.createElement("div");+ restored.innerHTML = html;+ return restored.firstElementChild;+ };+ check.equal(api.readListMindmap(restoreBatch(batchHistory[0].before)).metadata.summaries, undefined);+ check.equal(api.readListMindmap(restoreBatch(batchHistory[0].after)).metadata.summaries.length, 2);+ batchButton.click();+ const batchBlank = batchViewport.getBoundingClientRect();+ sendPointer(batchViewport, "pointerdown", batchBlank.left + 1, batchBlank.top + 1);+ sendPointer(batchViewport, "pointerup", batchBlank.left + 1, batchBlank.top + 1);+ for (const id of leafIDs.slice(0, 2)) {+ batchHost.querySelector(`[data-mindmap-id="${id}"]`).dispatchEvent(new PointerEvent("pointerdown", {+ bubbles: true, pointerId: 81, pointerType: "touch", isPrimary: true, button: 0,+ }));+ }+ check.equal(batchView.summarySelected.size, 2, "touch taps build a batch selection");+ check.equal(batchView.summaryRanges.length, 0, "existing groups are not duplicated");+ batchView.update(api.readListMindmap(batchList));+ check.equal(batchView.summarySelecting, false, "external updates invalidate pending selections");+ batchButton.click();+ sendPointer(batchViewport, "pointerdown", left, top);+ sendPointer(batchViewport, "pointermove", right, bottom);+ batchHost.dispatchEvent(new KeyboardEvent("keydown", {key: "Escape", bubbles: true}));+ check.equal(batchView.summarySelecting, false);+ check.equal(batchHistory.length, 1, "canceling never submits a second batch");+ batchView.destroy();+ batchHost.remove();style.remove();return "List mindmap DOM cases passed";};diff --git a/app/src/protyle/render/listMindmap/model.ts b/app/src/protyle/render/listMindmap/model.tsindex eaad90dc77..4fe0589d71 100644--- a/app/src/protyle/render/listMindmap/model.ts+++ b/app/src/protyle/render/listMindmap/model.ts@@ -1,7 +1,7 @@import {Constants} from "../../../constants";import {getOrderedListMarkerUpdates} from "../../wysiwyg/listContext";import type {MindmapManualRoute, MindmapRelationAnchor} from "./routing";-import {getListMindmapSiblingIDs, normalizeListMindmapSummaries} from "./summary";+import {getListMindmapSiblingIDs, isListMindmapSummaryCrossing, normalizeListMindmapSummaries} from "./summary";import type {ListMindmapSummary} from "./summary";export interface ListMindmapNodeStyle {@@ -33,7 +33,7 @@ export interface ListMindmapRelation {}export interface ListMindmapMetadata {- version: 1;+ version: 1 | 2;rootTitle?: string;viewLocked?: boolean;nodes: Record<string, ListMindmapNodeStyle>;@@ -94,7 +94,8 @@ export const parseListMindmapMetadata = (value: string | null): ListMindmapMetad} catch {throw invalidMetadata();}- if (!isRecord(data) || data.version !== 1 || !isRecord(data.nodes) || !Array.isArray(data.relations)) {+ if (!isRecord(data) || (data.version !== 1 && data.version !== 2) ||+ !isRecord(data.nodes) || !Array.isArray(data.relations)) {throw invalidMetadata();}const stringKeys = ["textColor", "backgroundColor", "borderColor", "lineColor"];@@ -164,13 +165,21 @@ export const parseListMindmapMetadata = (value: string | null): ListMindmapMetadthrow invalidMetadata();}summaryIds.add(summary.id);+ const localMembers = new Set<string>();for (const id of summary.nodeIds) {- if (typeof id !== "string" || !id || id === summary.parentId || members.has(id)) {+ if (typeof id !== "string" || !id || id === summary.parentId || localMembers.has(id) ||+ data.version === 1 && members.has(id)) {throw invalidMetadata();}members.add(id);+ localMembers.add(id);}}+ const summaries = data.summaries;+ if (data.version === 2 && summaries.some((a, index) => summaries.slice(index + 1).some(b =>+ a.parentId === b.parentId && isListMindmapSummaryCrossing(a.nodeIds, b.nodeIds)))) {+ throw invalidMetadata();+ }}return data as unknown as ListMindmapMetadata;};@@ -486,9 +495,11 @@ export const layoutListMindmap = (root: ListMindmapLayoutNode, options: {}}const heights = new Map<string, number>();+ const summaries = [...(options.summaries || [])].sort((a, b) =>+ a.nodeIds.length - b.nodeIds.length || a.height - b.height);[...ordered].reverse().forEach(({node}) => {const children = node.collapsed ? [] : node.children;- (options.summaries || []).forEach(summary => {+ summaries.forEach(summary => {const start = children.findIndex(child => child.id === summary.nodeIds[0]);if (start < 0 || !summary.nodeIds.every((id, index) => children[start + index]?.id === id)) {return;@@ -506,6 +517,8 @@ export const layoutListMindmap = (root: ListMindmapLayoutNode, options: {(index ? gapBefore(child.id) : 0), 0);heights.set(node.id, Math.max(node.height, childHeight));});+ (options.summaries || []).filter(summary => summary.nodeIds.length === 1 && summary.nodeIds[0] === root.id)+ .forEach(summary => heights.set(root.id, Math.max(heights.get(root.id), summary.height + 16)));const tops = new Map([[root.id, padding]]);const nodes = new Map<string, ListMindmapPosition>();const edges: {from: string, to: string}[] = [];@@ -672,7 +685,8 @@ export const normalizeListMindmapSummaryMetadata = (list: HTMLElement, previous:if (!model.metadata.summaries) {return;}- const summaries = normalizeListMindmapSummaries(model.metadata.summaries, getListMindmapSiblingIDs(model), previous, moved);+ const summaries = normalizeListMindmapSummaries(model.metadata.summaries, getListMindmapSiblingIDs(model),+ previous, moved, model.metadata.version);if (JSON.stringify(summaries) !== JSON.stringify(model.metadata.summaries)) {model.metadata.summaries = summaries;writeListMindmapMetadata(list, model.metadata);diff --git a/app/src/protyle/render/listMindmap/paste.test.ts b/app/src/protyle/render/listMindmap/paste.test.tsindex 234fd05487..b72a874889 100644--- a/app/src/protyle/render/listMindmap/paste.test.ts+++ b/app/src/protyle/render/listMindmap/paste.test.ts@@ -45,14 +45,15 @@ test("selected mind map nodes accept clipboard images after finishing the previo});test("mind map image paste respects edit state, selection and read-only boundaries", () => {- for (const mode of ["readonly", "editing", "relation", "summary", "virtual", "missing", "unselected",+ for (const mode of ["readonly", "editing", "relation", "summary", "batch", "virtual", "missing", "unselected","input", "editable", "handled", "text", "export"]) {const current = create();switch (mode) {case "readonly": current.target.readOnly = true; break;case "editing": current.target.editingId = "node"; break;case "relation": current.target.relationFrom = "node"; break;- case "summary": current.target.summaryFrom = "node"; 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 "missing": current.target.model.nodes.clear(); break;case "unselected": current.target.selectedId = undefined; break;diff --git a/app/src/protyle/render/listMindmap/summary.test.ts b/app/src/protyle/render/listMindmap/summary.test.tsindex 297652b1ec..577cfd142c 100644--- a/app/src/protyle/render/listMindmap/summary.test.ts+++ b/app/src/protyle/render/listMindmap/summary.test.ts@@ -1,6 +1,7 @@import * as assert from "node:assert/strict";import test from "node:test";-import {getListMindmapSummaryRange, layoutListMindmapSummaries, normalizeListMindmapSummaries} from "./summary";+import {addListMindmapSummaryRanges, getListMindmapSummaryRange, getListMindmapSummarySelection, isListMindmapSummaryCrossing,+ layoutListMindmapSummaries, normalizeListMindmapSummaries} from "./summary";import type {ListMindmapSummary} from "./summary";import type {ListMindmapModel, ListMindmapNode} from "./model";@@ -35,18 +36,21 @@ const makeModel = (): ListMindmapModel => {metadata: {version: 1, nodes: {}, relations: []}};};-test("summary creation accepts sibling ranges and rejects cross-level, overlapping and nested groups", () => {+test("summary creation accepts contained ranges and rejects cross-level, crossing and duplicate groups", () => {const model = makeModel();assert.deepEqual(getListMindmapSummaryRange(model, "c", "a"), ["a", "b", "c"]);assert.deepEqual(getListMindmapSummaryRange(model, "a", "nested"), []);assert.deepEqual(getListMindmapSummaryRange(model, "root", "root"), []);model.metadata.summaries = [summary(["a", "b"])];assert.deepEqual(getListMindmapSummaryRange(model, "b", "c"), []);- assert.deepEqual(getListMindmapSummaryRange(model, "nested", "nested"), []);+ assert.deepEqual(getListMindmapSummaryRange(model, "nested", "nested"), ["nested"]);+ assert.deepEqual(getListMindmapSummaryRange(model, "a", "c"), ["a", "b", "c"]);+ assert.deepEqual(getListMindmapSummaryRange(model, "a", "a"), ["a"]);+ assert.deepEqual(getListMindmapSummaryRange(model, "a", "b"), []);assert.deepEqual(getListMindmapSummaryRange(model, "c", "c"), ["c"]);});-test("summary brackets align member centers, avoid descendants and disappear with their members", () => {+test("summary brackets cover visible subtrees, single nodes and disappear with their members", () => {const model = makeModel();model.metadata.summaries = [summary(["a", "b"])];const positions = new Map([@@ -57,8 +61,8 @@ test("summary brackets align member centers, avoid descendants and disappear witconst sizes = new Map([["s", {width: 150, height: 60}]]);const expanded = layoutListMindmapSummaries(model, positions, sizes).get("s");assert.equal(expanded.x, 476);- assert.equal(expanded.top, 57);- assert.equal(expanded.bottom, 182);+ assert.equal(expanded.top, 9);+ assert.equal(expanded.bottom, 215);assert.equal(expanded.labelY + expanded.height / 2, (expanded.top + expanded.bottom) / 2);sizes.set("s", {width: 150, height: 400});const tall = layoutListMindmapSummaries(model, positions, sizes).get("s");@@ -67,8 +71,8 @@ test("summary brackets align member centers, avoid descendants and disappear witassert.equal(tall.labelY + tall.height / 2, (expanded.top + expanded.bottom) / 2);model.metadata.summaries = [summary(["a"])];const single = layoutListMindmapSummaries(model, positions, sizes).get("s");- assert.equal(single.top, 57);- assert.equal(single.bottom, 57);+ assert.equal(single.top, 9);+ assert.equal(single.bottom, 115);assert.equal(single.x, 476);model.metadata.summaries = [summary(["a", "b"])];positions.delete("nested");@@ -76,3 +80,92 @@ test("summary brackets align member centers, avoid descendants and disappear witpositions.delete("a");assert.equal(layoutListMindmapSummaries(model, positions, sizes).size, 0);});++test("nested summaries survive normalization regardless of array order and follow structural edits", () => {+ const inner = {...summary(["a", "b"]), id: "inner"};+ const outer = {...summary(["a", "b", "c"]), id: "outer"};+ const before = siblings("a", "b", "c", "d");+ for (const original of [[inner, outer], [outer, inner]]) {+ const normalize = (ids: string[]) => normalizeListMindmapSummaries(original, siblings(...ids), before,+ new Set<string>(), 2);+ assert.deepEqual(normalize(["a", "b", "c", "d"]), original);+ const inserted = normalize(["a", "new", "b", "c", "d"]);+ assert.deepEqual(inserted.find(item => item.id === "inner").nodeIds, ["a", "new", "b"]);+ assert.deepEqual(inserted.find(item => item.id === "outer").nodeIds, ["a", "new", "b", "c"]);+ assert.deepEqual(normalize(["c", "d"]).map(item => item.id), ["outer"]);+ assert.deepEqual(normalize(["d"]), []);+ }+});++test("reordering nested ranges keeps their membership laminar for every sibling permutation", () => {+ const original = [summary(["a", "b", "c", "d", "e"]),+ {...summary(["b", "c", "d"]), id: "inner"}, {...summary(["b", "c"]), id: "deep"}];+ const before = siblings("a", "b", "c", "d", "e", "outside");+ const permutations = (ids: string[]): string[][] => ids.length ? ids.flatMap((id, index) =>+ permutations(ids.filter((_id, i) => i !== index)).map(rest => [id, ...rest])) : [[]];+ for (const ids of permutations(before.get("root"))) {+ const normalized = normalizeListMindmapSummaries(original, siblings(...ids), before, new Set(["b"]), 2);+ normalized.forEach((a, index) => normalized.slice(index + 1).forEach(b => {+ assert.equal(isListMindmapSummaryCrossing(a.nodeIds, b.nodeIds), false, JSON.stringify({ids, normalized}));+ }));+ const reverse = normalizeListMindmapSummaries([...original].reverse(), siblings(...ids), before, new Set(["b"]), 2);+ assert.deepEqual(reverse.reverse(), normalized);+ }+});++test("a single real root can have a summary without creating a virtual parent block", () => {+ const model = makeModel();+ model.list = {dataset: {nodeId: "list"}} as unknown as HTMLElement;+ assert.deepEqual(getListMindmapSummaryRange(model, "root", "root"), ["root"]);+ assert.deepEqual(getListMindmapSummarySelection(model, new Set(["root", "a"])).ranges,+ [{parentId: "list", nodeIds: ["root"]}]);+});++test("batch selection partitions contiguous siblings, omits descendants and detects conflicts", () => {+ const model = makeModel();+ assert.deepEqual(getListMindmapSummarySelection(model, new Set(["a", "nested", "c"])), {+ ranges: [{parentId: "root", nodeIds: ["a"]}, {parentId: "root", nodeIds: ["c"]}], conflict: false,+ });+ assert.deepEqual(getListMindmapSummarySelection(model, new Set(["nested", "b"])).ranges, [+ {parentId: "root", nodeIds: ["b"]}, {parentId: "a", nodeIds: ["nested"]},+ ]);+ model.metadata.summaries = [summary(["a", "b"])];+ assert.equal(getListMindmapSummarySelection(model, new Set(["b", "c"])).conflict, true);+ assert.deepEqual(getListMindmapSummarySelection(model, new Set(["a", "b"])).ranges, []);+});++test("batch creation is atomic and upgrades only configurations that require nesting", () => {+ const model = makeModel();+ let next = 0;+ const add = (ranges: {parentId: string, nodeIds: string[]}[]) =>+ addListMindmapSummaryRanges(model, ranges, () => `summary-${++next}`, "Summary");+ const snapshot = JSON.stringify(model.metadata);+ assert.equal(add([{parentId: "root", nodeIds: ["a"]}, {parentId: "root", nodeIds: ["b", "missing"]}]), undefined);+ assert.equal(JSON.stringify(model.metadata), snapshot);+ assert.equal(next, 0);+ assert.deepEqual(add([{parentId: "root", nodeIds: ["a", "b"]}]), ["summary-1"]);+ assert.equal(model.metadata.version, 1);+ assert.deepEqual(add([{parentId: "a", nodeIds: ["nested"]}]), ["summary-2"]);+ assert.equal(model.metadata.version, 2);+ assert.equal(add([{parentId: "root", nodeIds: ["b", "c"]}]), undefined);+ assert.equal(model.metadata.summaries.length, 2);+});++test("outer summaries enclose inner brackets and labels independently of persistence order", () => {+ const model = makeModel();+ const inner = {...summary(["a"]), id: "inner"};+ const outer = {...summary(["a", "b"]), id: "outer"};+ const positions = new Map([+ ["a", {id: "a", x: 100, y: 40, width: 100, height: 40}],+ ["b", {id: "b", x: 100, y: 160, width: 120, height: 50}],+ ["nested", {id: "nested", x: 240, y: 20, width: 200, height: 90}],+ ]);+ const sizes = new Map([["inner", {width: 150, height: 60}], ["outer", {width: 180, height: 70}]]);+ model.metadata.summaries = [outer, inner];+ const first = layoutListMindmapSummaries(model, positions, sizes);+ model.metadata.summaries = [inner, outer];+ assert.deepEqual(layoutListMindmapSummaries(model, positions, sizes), first);+ assert.ok(first.get("outer").x > first.get("inner").labelX + first.get("inner").width);+ assert.ok(first.get("outer").top < first.get("inner").top);+ assert.ok(first.get("outer").bottom > first.get("inner").bottom);+});diff --git a/app/src/protyle/render/listMindmap/summary.ts b/app/src/protyle/render/listMindmap/summary.tsindex ee8585377b..8dfbb3da09 100644--- a/app/src/protyle/render/listMindmap/summary.ts+++ b/app/src/protyle/render/listMindmap/summary.ts@@ -19,9 +19,27 @@ export interface ListMindmapSummaryPosition {height: number;}+export interface ListMindmapSummaryRange {+ parentId: string;+ nodeIds: string[];+}++export const isListMindmapSummaryCrossing = (a: string[], b: string[]) => {+ const members = new Set(a);+ const common = b.filter(id => members.has(id)).length;+ return common > 0 && common < a.length && common < b.length;+};++export const getListMindmapSummaryParentID = (model: ListMindmapModel, id: string) => {+ const node = model.nodes.get(id);+ return node?.parentId || (node === model.root && !node.virtual ? model.list?.dataset.nodeId : undefined);+};+export const getListMindmapSiblingIDs = (model: ListMindmapModel) => {const siblings = new Map<string, string[]>();- siblings.set(model.list.dataset.nodeId, model.root.virtual ? model.root.children.map(node => node.id) : [model.root.id]);+ if (model.list) {+ siblings.set(model.list.dataset.nodeId, model.root.virtual ? model.root.children.map(node => node.id) : [model.root.id]);+ }model.nodes.forEach(node => {if (node.children.length) {siblings.set(node.id, node.children.map(child => child.id));@@ -32,14 +50,14 @@ export const getListMindmapSiblingIDs = (model: ListMindmapModel) => {// 新插入的节点只在已有成员之间加入范围;原有范围被拆开时保留未移动成员最多的连续部分。export const normalizeListMindmapSummaries = (summaries: ListMindmapSummary[], siblings: Map<string, string[]>,- previous = siblings, moved = new Set<string>()) => {+ previous = siblings, moved = new Set<string>(), version = 1) => {const claimed = new Set<string>();- return summaries.flatMap(summary => {+ const normalized = summaries.flatMap(summary => {const members = new Set(summary.nodeIds);const old = new Set(previous.get(summary.parentId) || []);const groups: string[][] = [[]];(siblings.get(summary.parentId) || []).forEach(id => {- if (!claimed.has(id) && (members.has(id) || !old.has(id))) {+ if ((version === 2 || !claimed.has(id)) && (members.has(id) || !old.has(id))) {groups[groups.length - 1].push(id);} else if (groups[groups.length - 1].length) {groups.push([]);@@ -59,41 +77,128 @@ export const normalizeListMindmapSummaries = (summaries: ListMindmapSummary[], snodeIds.forEach(id => claimed.add(id));return [{...summary, nodeIds}];});+ if (version === 2) {+ const originals = new Map(summaries.map(summary => [summary.id, summary]));+ const ordered = [...normalized].sort((a, b) => originals.get(b.id).nodeIds.length -+ originals.get(a.id).nodeIds.length || a.id.localeCompare(b.id));+ // 结构编辑造成交叉时,内层范围保留与原外层的交集,范围完全分离时各自保留。+ ordered.forEach((outer, index) => {+ ordered.slice(index + 1).forEach(inner => {+ const originalOuter = new Set(originals.get(outer.id).nodeIds);+ if (outer.parentId === inner.parentId &&+ originals.get(inner.id).nodeIds.every(id => originalOuter.has(id)) &&+ isListMindmapSummaryCrossing(outer.nodeIds, inner.nodeIds)) {+ const members = new Set(outer.nodeIds);+ inner.nodeIds = inner.nodeIds.filter(id => members.has(id));+ }+ });+ });+ }+ return normalized;};export const getListMindmapSummaryRange = (model: ListMindmapModel, from: string, to: string) => {- const parentId = model.nodes.get(from)?.parentId;- if (!parentId || model.nodes.get(to)?.parentId !== parentId) {+ const parentId = getListMindmapSummaryParentID(model, from);+ if (!parentId || getListMindmapSummaryParentID(model, to) !== parentId) {return [];}- const siblings = model.nodes.get(parentId)?.children || [];- const start = siblings.findIndex(node => node.id === from);- const end = siblings.findIndex(node => node.id === to);+ const siblings = model.nodes.get(parentId)?.children.map(node => node.id) ||+ (model.list?.dataset.nodeId === parentId ? [model.root.id] : []);+ const start = siblings.indexOf(from);+ const end = siblings.indexOf(to);if (start < 0 || end < 0) {return [];}- const nodeIds = siblings.slice(Math.min(start, end), Math.max(start, end) + 1).map(node => node.id);- const related = (a: string, b: string) => {- while (a) {- if (a === b) {- return true;- }- a = model.nodes.get(a)?.parentId;- }- return false;- };- if (model.metadata.summaries?.some(summary => summary.nodeIds.some(member =>- nodeIds.some(id => related(member, id) || related(id, member))))) {+ const nodeIds = siblings.slice(Math.min(start, end), Math.max(start, end) + 1);+ if (model.metadata.summaries?.some(summary => summary.parentId === parentId &&+ (isListMindmapSummaryCrossing(nodeIds, summary.nodeIds) ||+ nodeIds.length === summary.nodeIds.length && nodeIds.every(id => summary.nodeIds.includes(id))))) {return [];}return nodeIds;};-// 括号连接首尾成员的垂直中心,横向避让可见子树,标签高度独立参与画布边界计算。+// 框选只保留最外层的选中节点,并按父节点及连续范围分组。+export const getListMindmapSummarySelection = (model: ListMindmapModel, selected: Set<string>) => {+ const groups: ListMindmapSummaryRange[] = [];+ getListMindmapSiblingIDs(model).forEach((ids, parentId) => {+ let group: string[] = [];+ const finish = () => {+ if (group.length) {+ groups.push({parentId, nodeIds: group});+ group = [];+ }+ };+ ids.forEach(id => {+ let parent = model.nodes.get(id)?.parentId;+ let covered = false;+ while (parent) {+ covered ||= selected.has(parent);+ parent = model.nodes.get(parent)?.parentId;+ }+ if (selected.has(id) && !covered) {+ group.push(id);+ } else {+ finish();+ }+ });+ finish();+ });+ const conflict = groups.some(group => model.metadata.summaries?.some(summary =>+ summary.parentId === group.parentId && isListMindmapSummaryCrossing(group.nodeIds, summary.nodeIds)));+ const ranges = groups.filter(group => !model.metadata.summaries?.some(summary =>+ summary.parentId === group.parentId && group.nodeIds.length === summary.nodeIds.length &&+ group.nodeIds.every(id => summary.nodeIds.includes(id))));+ return {ranges, conflict};+};++export const getListMindmapSummaryCoverage = (model: ListMindmapModel, nodeIds: string[]) => {+ const covered = new Set<string>();+ const pending = [...nodeIds];+ while (pending.length) {+ const id = pending.pop();+ if (covered.has(id)) {+ continue;+ }+ covered.add(id);+ pending.push(...(model.nodes.get(id)?.children.map(node => node.id) || []));+ }+ return covered;+};++export const getListMindmapSummarySnapshot = (model: ListMindmapModel) =>+ JSON.stringify({siblings: [...getListMindmapSiblingIDs(model)], metadata: model.metadata});++// 全部范围校验通过后才修改配置,嵌套配置使用显式版本,保留已有概要身份与扩展字段。+export const addListMindmapSummaryRanges = (model: ListMindmapModel, ranges: ListMindmapSummaryRange[],+ newID: () => string, label: string) => {+ if (!ranges.length || ranges.some(range => !range.nodeIds.length ||+ getListMindmapSummaryParentID(model, range.nodeIds[0]) !== range.parentId ||+ JSON.stringify(getListMindmapSummaryRange(model, range.nodeIds[0], range.nodeIds[range.nodeIds.length - 1])) !==+ JSON.stringify(range.nodeIds)) || ranges.some((a, index) => ranges.slice(index + 1).some(b =>+ a.parentId === b.parentId && (isListMindmapSummaryCrossing(a.nodeIds, b.nodeIds) ||+ a.nodeIds.length === b.nodeIds.length && a.nodeIds.every(id => b.nodeIds.includes(id)))))) {+ return undefined;+ }+ const added = ranges.map(range => ({...range, nodeIds: [...range.nodeIds], id: newID(), label}));+ const summaries = [...(model.metadata.summaries || []), ...added];+ const coverage = summaries.map(summary => getListMindmapSummaryCoverage(model, summary.nodeIds));+ if (coverage.some((a, index) => coverage.slice(index + 1).some(b => [...a].some(id => b.has(id))))) {+ model.metadata.version = 2;+ }+ model.metadata.summaries = summaries;+ return added.map(summary => summary.id);+};++// 括号包围可见子树及内层概要,按包含范围由内到外布局。export const layoutListMindmapSummaries = (model: ListMindmapModel, positions: Map<string, ListMindmapPosition>,sizes: Map<string, {width: number, height: number}>) => {const result = new Map<string, ListMindmapSummaryPosition>();- (model.metadata.summaries || []).forEach(summary => {+ const coverage = new Map((model.metadata.summaries || []).map(summary =>+ [summary.id, getListMindmapSummaryCoverage(model, summary.nodeIds)]));+ const ordered = [...(model.metadata.summaries || [])].sort((a, b) =>+ coverage.get(a.id).size - coverage.get(b.id).size || a.id.localeCompare(b.id));+ ordered.forEach(summary => {const size = sizes.get(summary.id);if (!size || !summary.nodeIds.length || summary.nodeIds.some(id => !positions.has(id))) {return;@@ -105,22 +210,28 @@ export const layoutListMindmapSummaries = (model: ListMindmapModel, positions: Mreturn;}let right = 0;- const pending = [...summary.nodeIds];- while (pending.length) {- const id = pending.pop();+ let top = Infinity;+ let bottom = -Infinity;+ const members = coverage.get(summary.id);+ members.forEach(id => {const position = positions.get(id);if (!position) {- continue;+ return;}right = Math.max(right, position.x + position.width);- pending.push(...(model.nodes.get(id)?.children.map(node => node.id) || []));- }- const nodeCenter = (id: string) => {- const position = positions.get(id);- return position.y - (id === model.root.id ? 1 : 3) + position.height / 2;- };- const top = nodeCenter(summary.nodeIds[0]);- const bottom = nodeCenter(summary.nodeIds[summary.nodeIds.length - 1]);+ const y = position.y - (id === model.root.id ? 1 : 3);+ top = Math.min(top, y);+ bottom = Math.max(bottom, y + position.height);+ });+ result.forEach(inner => {+ if ([...coverage.get(inner.id)].every(id => members.has(id))) {+ right = Math.max(right, inner.labelX + inner.width);+ top = Math.min(top, inner.top, inner.labelY);+ bottom = Math.max(bottom, inner.bottom, inner.labelY + inner.height);+ }+ });+ top -= 8;+ bottom += 8;const center = (top + bottom) / 2;result.set(summary.id, {id: summary.id, x: right + 36, top, bottom,labelX: right + 60, labelY: center - size.height / 2, ...size});diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 3917d50f47..1e5925af78 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -18,8 +18,9 @@ import {destroyTabsRender, tabsRender} from "../tabsRender";import {getListMindmapFoldStates, getListMindmapSiblingFoldStates} from "./fold";import type {ListMindmapFoldTarget} from "./fold";import {clampMindmapPanOffset} from "./pan";-import {getListMindmapSummaryRange, layoutListMindmapSummaries} from "./summary";-import type {ListMindmapSummary, ListMindmapSummaryPosition} from "./summary";+import {getListMindmapSummaryParentID, getListMindmapSummaryRange, getListMindmapSummarySelection, getListMindmapSummarySnapshot,+ layoutListMindmapSummaries} from "./summary";+import type {ListMindmapSummary, ListMindmapSummaryPosition, ListMindmapSummaryRange} from "./summary";export interface ListMindmapViewOptions {host: HTMLElement;@@ -65,6 +66,7 @@ export interface ListMindmapViewOptions {onRelationChange?: (id: string, patch: Partial<ListMindmapRelation>, expected?: string) => void;onRelationDelete?: (id: string) => void;onSummaryAdd?: (from: string, to: string) => Promise<string | undefined>;+ onSummaryBatchAdd?: (ranges: ListMindmapSummaryRange[], expected: string) => Promise<string[] | undefined>;onSummaryChange?: (id: string, patch: Pick<Partial<ListMindmapSummary>, "label" | "color">, expected?: string) => void;onSummaryDelete?: (id: string) => void;onExit: () => void;@@ -79,6 +81,7 @@ interface PointerState {x: number;y: number;moved: boolean;+ summary?: boolean;targetId?: string;placement?: "before" | "child" | "after";relation?: {@@ -123,6 +126,14 @@ export class ListMindmapView {private readonly summaryStatus = createElement("div", "mindmap-view__route-status");private selectedSummary?: string;private summaryFrom?: string;+ private summarySelecting = false;+ private summarySnapshot?: string;+ private summarySelected = new Set<string>();+ private summaryRanges: ListMindmapSummaryRange[] = [];+ private readonly summaryControls = createElement("div", "mindmap-view__inspector mindmap-view__summary-controls");+ private readonly summaryCount = createElement("span", "");+ private readonly summaryConfirm = createElement("button", "b3-button b3-button--text");+ private readonly summaryBox = createElement("div", "mindmap-view__selection-box");private finishSummaryEdit?: (save: boolean) => void;private editingSummary?: string;private readonly buttons = new Map<string, HTMLButtonElement>();@@ -206,6 +217,22 @@ export class ListMindmapView {this.summaryStatus.setAttribute("role", "status");this.summaryStatus.textContent = this.label("listMindmapSummarySelect");options.host.append(this.summaryStatus);+ this.summaryControls.hidden = true;+ this.summaryCount.setAttribute("role", "status");+ this.summaryConfirm.type = "button";+ this.summaryConfirm.textContent = this.label("confirm");+ this.summaryConfirm.addEventListener("click", () => void this.confirmSummarySelection());+ const cancelSummary = createElement("button", "b3-button b3-button--cancel");+ cancelSummary.type = "button";+ cancelSummary.textContent = this.label("cancel");+ cancelSummary.addEventListener("click", () => {+ this.cancelSummarySelection();+ this.updateSelection();+ });+ this.summaryControls.append(this.summaryCount, this.summaryConfirm, cancelSummary);+ options.host.append(this.summaryControls);+ this.summaryBox.hidden = true;+ this.viewport.append(this.summaryBox);this.createToolbar();this.listen(document, "pointerdown", this.dismissControls, {capture: true});this.listen(options.host, "pointerover", this.showButtonTooltip);@@ -346,7 +373,7 @@ export class ListMindmapView {private clearSelection() {this.inspector.hidden = true;if (!this.selectedId && !this.selectedRelation && !this.selectedEdge && !this.relationFrom &&- !this.selectedSummary && !this.summaryFrom) {+ !this.selectedSummary && !this.summarySelecting) {return;}this.selectedId = undefined;@@ -354,13 +381,16 @@ export class ListMindmapView {this.selectedEdge = undefined;this.relationFrom = undefined;this.selectedSummary = undefined;- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.updateSelection();}private dismissControls = (event: PointerEvent) => {const target = event.target as Node;this.tooltip.hidden = true;+ if (this.summarySelecting && (this.viewport.contains(target) || this.summaryControls.contains(target))) {+ return;+ }if (target instanceof Element && target.closest(".mindmap-view__relation-editor, .mindmap-view__route-handle, .mindmap-view__summary-editor")) {return;}@@ -420,7 +450,7 @@ export class ListMindmapView {private refreshControls() {const value = !!this.readOnly;this.finishSummaryEdit?.(false);- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.cancelPointer();this.relationFrom = undefined;this.inspector.hidden = true;@@ -471,14 +501,24 @@ export class ListMindmapView {}if (!this.readOnly) {add("summary", "listMindmapSummary", "iconGroups", () => {- this.setPanning(false);- this.inspector.hidden = true;- this.relationFrom = undefined;- this.summaryFrom = this.summaryFrom ? undefined : this.selectedId;- this.updateSelection();+ this.finishThen(() => {+ const selecting = !this.summarySelecting;+ this.cancelPointer();+ this.cancelSummarySelection();+ this.setPanning(false);+ this.inspector.hidden = true;+ this.relationFrom = undefined;+ this.summarySelecting = selecting;+ if (selecting) {+ this.summarySnapshot = getListMindmapSummarySnapshot(this.model);+ this.summaryFrom = getListMindmapSummaryRange(this.model, this.selectedId, this.selectedId).length ?+ this.selectedId : undefined;+ }+ this.updateSelection();+ });});add("relation", "connect", "iconRoute", () => {- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.setPanning(false);this.inspector.hidden = true;this.relationFrom = this.relationFrom ? undefined : this.selectedId;@@ -543,7 +583,7 @@ export class ListMindmapView {private setPanning(value: boolean) {if (value) {- this.summaryFrom = undefined;+ this.cancelSummarySelection();}this.panning = value;this.viewport.classList.toggle("mindmap-view__viewport--pan", value);@@ -553,7 +593,7 @@ export class ListMindmapView {}public update(model: ListMindmapModel) {- if (this.pointer?.relation) {+ if (this.pointer?.relation || this.pointer?.summary) {this.cancelPointer();}if (this.destroyed) {@@ -564,7 +604,7 @@ export class ListMindmapView {this.persistedLocked = !!model.metadata.viewLocked;this.setLocked(this.persistedLocked);}- this.summaryFrom = undefined;+ this.cancelSummarySelection();if (this.levelSelect) {const placeholder = new Option(this.label("expandLevel"), "");placeholder.disabled = true;@@ -1064,7 +1104,7 @@ export class ListMindmapView {this.selectedRelation = undefined;this.selectedEdge = undefined;this.relationFrom = undefined;- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.inspector.hidden = !!this.readOnly;this.updateSelection();this.renderInspector();@@ -1075,7 +1115,7 @@ export class ListMindmapView {if (!from || !getListMindmapSummaryRange(this.model, from, id).length) {return;}- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.updateSelection();void this.options.onSummaryAdd?.(from, id).then(summaryId => {if (summaryId && !this.destroyed) {@@ -1089,6 +1129,55 @@ export class ListMindmapView {}).catch(error => console.error(error));}+ private cancelSummarySelection() {+ this.summarySelecting = false;+ this.summaryFrom = undefined;+ this.summarySnapshot = undefined;+ this.summarySelected.clear();+ this.summaryRanges = [];+ this.summaryControls.hidden = true;+ this.summaryBox.hidden = true;+ }++ private previewSummarySelection() {+ const {ranges, conflict} = getListMindmapSummarySelection(this.model, this.summarySelected);+ this.summaryRanges = ranges;+ this.summaryConfirm.disabled = conflict || !ranges.length || !this.options.onSummaryBatchAdd;+ this.summaryCount.textContent = conflict ? this.label("listMindmapSummaryConflict") :+ this.label("listMindmapSummaryBatch").replace("${count}", String(ranges.length));+ this.summaryControls.hidden = false;+ this.updateSelection();+ }++ private async confirmSummarySelection() {+ if (!this.summarySelecting || this.summaryConfirm.disabled || this.readOnly) {+ return;+ }+ const ranges = this.summaryRanges;+ const expected = this.summarySnapshot;+ this.summaryConfirm.disabled = true;+ let ids: string[];+ try {+ ids = await this.options.onSummaryBatchAdd?.(ranges, expected);+ } catch (error) {+ console.error(error);+ }+ if (this.destroyed) {+ return;+ }+ this.cancelSummarySelection();+ if (ids?.length === 1) {+ this.selectSummary(ids[0]);+ requestAnimationFrame(() => {+ if (!this.destroyed && this.selectedSummary === ids[0]) {+ this.editSummaryLabel(ids[0]);+ }+ });+ } else {+ this.updateSelection();+ }+ }+private editSummaryLabel(id: string) {const summary = this.model.metadata.summaries?.find(item => item.id === id);const position = this.summaryPositions.get(id);@@ -1196,7 +1285,7 @@ export class ListMindmapView {this.finishThen(() => {this.selectedRelation = relation.id;this.selectedSummary = undefined;- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.selectedEdge = undefined;this.relationFrom = undefined;this.selectedId = undefined;@@ -1673,6 +1762,31 @@ export class ListMindmapView {this.drawRelationPreview(context, resolveColor(relationStyles[0].color, primary), relationStyles[0].width || 1.5);this.drawSummaries(context, (color, selected, hovered) =>resolveLineStyle(summaryStyles, color, undefined, defaultLine, selected, hovered));+ if (this.summarySelecting && !this.printTransform && !this.options.printLayout && this.summaryRanges.length) {+ const previews = this.summaryRanges.map((range, index) => ({...range, id: `preview:${index}`, label: ""}));+ const sizes = new Map([...this.summaryPositions].map(([id, position]) =>+ [id, {width: position.width, height: position.height}]));+ previews.forEach(preview => sizes.set(preview.id, {width: 0, height: 0}));+ const model = {...this.model, metadata: {...this.model.metadata,+ summaries: [...(this.model.metadata.summaries || []), ...previews]}};+ const positions = layoutListMindmapSummaries(model, this.positions, sizes);+ context.save();+ context.strokeStyle = primary;+ context.lineWidth = 1.5 / this.scale;+ context.setLineDash([4 / this.scale, 4 / this.scale]);+ previews.forEach(preview => {+ const position = positions.get(preview.id);+ if (position) {+ context.beginPath();+ context.moveTo(position.x - 10, position.top);+ context.lineTo(position.x, position.top);+ context.lineTo(position.x, position.bottom);+ context.lineTo(position.x - 10, position.bottom);+ context.stroke();+ }+ });+ context.restore();+ }this.renderRouteControls();}@@ -1751,7 +1865,7 @@ export class ListMindmapView {this.selectedRelation = undefined;this.selectedEdge = undefined;this.updateSelection();- if (!this.readOnly && !this.relationFrom && !this.summaryFrom) {+ if (!this.readOnly && !this.relationFrom && !this.summarySelecting) {this.inspector.hidden = false;}if (changed || !this.inspector.hidden) {@@ -1764,17 +1878,18 @@ export class ListMindmapView {this.relationPreview = undefined;}this.nodeElements.forEach((element, id) => {- element.classList.toggle("mindmap-view__node--selected", this.selectedId === id);+ const selected = this.selectedId === 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 &&getListMindmapSummaryRange(this.model, this.summaryFrom, id).length > 0);- element.setAttribute("aria-selected", String(this.selectedId === id));+ element.setAttribute("aria-selected", String(selected));});this.relationElements.forEach((element, id) => element.classList.toggle("mindmap-view__relation--selected", this.selectedRelation === id));const node = this.model.nodes.get(this.selectedId);const disabled: Record<string, boolean> = {relation: !node || node.virtual,- summary: !this.summaryFrom && (!node || !getListMindmapSummaryRange(this.model, node.id, node.id).length),+ summary: false,style: !node && !this.selectedRelation && !this.selectedEdge,};Object.keys(disabled).forEach((key) => {@@ -1784,9 +1899,10 @@ export class ListMindmapView {}});this.buttons.get("relation")?.classList.toggle("block__icon--active", !!this.relationFrom);- this.buttons.get("summary")?.classList.toggle("block__icon--active", !!this.summaryFrom);- this.buttons.get("summary")?.setAttribute("aria-pressed", String(!!this.summaryFrom));- this.summaryStatus.hidden = !this.summaryFrom;+ this.buttons.get("summary")?.classList.toggle("block__icon--active", this.summarySelecting);+ this.buttons.get("summary")?.setAttribute("aria-pressed", String(this.summarySelecting));+ this.summaryStatus.hidden = !this.summarySelecting || !this.summaryControls.hidden;+ this.viewport.classList.toggle("mindmap-view__viewport--summary", this.summarySelecting);this.draw();}@@ -1859,7 +1975,7 @@ export class ListMindmapView {}this.selectedId = selected.id;this.selectedSummary = undefined;- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.selectedRelation = undefined;this.selectedEdge = undefined;this.relationFrom = undefined;@@ -1974,10 +2090,39 @@ export class ListMindmapView {}private beginPointer(event: PointerEvent, id?: string) {- if (this.summaryFrom && id && !this.readOnly && event.button === 0 && !this.panning) {+ if (this.summarySelecting && !this.readOnly && event.button === 0 && !this.panning) {event.preventDefault();this.suppressLinkClick = true;- this.finishSummaryRange(id);+ if (id) {+ if (this.summaryFrom) {+ this.finishSummaryRange(id);+ } else if (!this.model.nodes.get(id)?.virtual && getListMindmapSummaryParentID(this.model, id)) {+ if (this.summarySelected.has(id)) {+ this.summarySelected.delete(id);+ } else {+ this.summarySelected.add(id);+ }+ this.selectedId = undefined;+ this.previewSummarySelection();+ }+ this.cancelPointer();+ return;+ }+ this.summaryFrom = undefined;+ this.selectedId = undefined;+ this.summarySelected.clear();+ this.summaryRanges = [];+ this.summaryControls.hidden = true;+ this.options.host.focus({preventScroll: true});+ this.pointer = {pointerId: event.pointerId, startX: event.clientX, startY: event.clientY,+ x: this.offsetX, y: this.offsetY, moved: false, summary: true};+ try {+ this.pointerCapture = this.viewport;+ this.viewport.setPointerCapture(event.pointerId);+ } catch {+ this.cancelPointer();+ }+ this.updateSelection();return;}if (this.panning || event.button === 2) {@@ -2077,6 +2222,31 @@ export class ListMindmapView {}event.preventDefault();pointer.moved = true;+ if (pointer.summary) {+ const viewport = this.viewport.getBoundingClientRect();+ const left = Math.min(pointer.startX, event.clientX);+ const right = Math.max(pointer.startX, event.clientX);+ const top = Math.min(pointer.startY, event.clientY);+ const bottom = Math.max(pointer.startY, event.clientY);+ this.summaryBox.hidden = false;+ this.summaryBox.style.left = `${left - viewport.left}px`;+ this.summaryBox.style.top = `${top - viewport.top}px`;+ this.summaryBox.style.width = `${right - left}px`;+ this.summaryBox.style.height = `${bottom - top}px`;+ this.summarySelected.clear();+ this.positions.forEach((position, id) => {+ const node = this.model.nodes.get(id);+ const x = viewport.left + this.offsetX + (position.x + position.width / 2) * this.scale;+ const y = viewport.top + this.offsetY + (position.y - (id === this.model.root.id ? 1 : 3) ++ position.height / 2) * this.scale;+ if (!node.virtual && getListMindmapSummaryParentID(this.model, id) &&+ x >= left && x <= right && y >= top && y <= bottom) {+ this.summarySelected.add(id);+ }+ });+ this.previewSummarySelection();+ return;+ }if (pointer.relation) {const drag = pointer.relation;if (drag.endpoint) {@@ -2197,6 +2367,13 @@ export class ListMindmapView {return;}const {id, targetId, placement, moved} = pointer;+ if (pointer.summary) {+ this.suppressLinkClick = true;+ pointer.summary = false;+ this.cancelPointer();+ this.previewSummarySelection();+ return;+ }if (pointer.relation) {if (moved) {this.previewRouteDrag();@@ -2289,7 +2466,7 @@ export class ListMindmapView {return;}this.selectedSummary = undefined;- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.selectedId = undefined;this.relationFrom = undefined;this.selectedRelation = line.relation ? line.id : undefined;@@ -2314,6 +2491,13 @@ export class ListMindmapView {this.clearDrop();const pointer = this.pointer;this.pointer = undefined;+ this.summaryBox.hidden = true;+ if (pointer?.summary) {+ this.summarySelected.clear();+ this.summaryRanges = [];+ this.summaryControls.hidden = true;+ this.updateSelection();+ }if (pointer && this.pointerCapture?.hasPointerCapture(pointer.pointerId)) {this.pointerCapture.releasePointerCapture(pointer.pointerId);}@@ -2344,7 +2528,7 @@ export class ListMindmapView {return;}clearTimeout(this.linkTimer);- if (this.panning || this.suppressLinkClick || this.relationFrom || this.summaryFrom || event.detail > 1) {+ if (this.panning || this.suppressLinkClick || this.relationFrom || this.summarySelecting || event.detail > 1) {event.preventDefault();return;}@@ -2367,7 +2551,7 @@ export class ListMindmapView {private doubleClick = (event: MouseEvent) => {clearTimeout(this.linkTimer);- if (this.readOnly || this.relationFrom || this.summaryFrom || this.panning || this.pinching) {+ if (this.readOnly || this.relationFrom || this.summarySelecting || this.panning || this.pinching) {return;}const target = event.target as HTMLElement;@@ -2644,7 +2828,7 @@ export class ListMindmapView {}private pasteImages = (event: ClipboardEvent) => {- if (event.defaultPrevented || this.readOnly || this.editingId || this.relationFrom || this.summaryFrom ||+ if (event.defaultPrevented || this.readOnly || this.editingId || this.relationFrom || this.summarySelecting ||!this.options.onPasteImages || !this.selectedId ||(event.target as HTMLElement).isContentEditable ||(event.target as HTMLElement).closest("input, textarea, select")) {@@ -2682,13 +2866,17 @@ export class ListMindmapView {if (this.pointer?.relation && event.key !== "Escape") {return;}- if (this.summaryFrom && event.key !== "Escape") {+ if (this.summarySelecting && event.key !== "Escape") {if (startingComposition || event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) {return;}if (event.key === "Enter") {- this.finishSummaryRange(this.selectedId);- } else if (event.key === "ArrowUp" || event.key === "ArrowDown") {+ if (this.summaryFrom) {+ this.finishSummaryRange(this.selectedId);+ } else {+ void this.confirmSummarySelection();+ }+ } else if (this.summaryFrom && (event.key === "ArrowUp" || event.key === "ArrowDown")) {const parent = this.model.nodes.get(this.model.nodes.get(this.summaryFrom)?.parentId);const index = parent?.children.findIndex(node => node.id === this.selectedId) ?? -1;const next = parent?.children[index + (event.key === "ArrowUp" ? -1 : 1)];@@ -2823,6 +3011,7 @@ export class ListMindmapView {});} else if (!startingComposition && event.key === "Escape") {const draggingRoute = !!this.pointer?.relation;+ const selectingSummary = this.summarySelecting;this.cancelPointer();if (draggingRoute) {event.preventDefault();@@ -2830,9 +3019,9 @@ export class ListMindmapView {return;}this.relationFrom = undefined;- this.summaryFrom = undefined;+ this.cancelSummarySelection();this.inspector.hidden = true;- if (this.fullscreenMarker) {+ if (this.fullscreenMarker && !selectingSummary) {this.exitFullscreen();}this.updateSelection();diff --git a/docs/LIST-MINDMAP.md b/docs/LIST-MINDMAP.mdindex f19cbdc2e7..3bb38fd4a2 100644--- a/docs/LIST-MINDMAP.md+++ b/docs/LIST-MINDMAP.md@@ -27,10 +27,12 @@- 滚轮或触控板滚动用于移动画布,Ctrl + 滚轮或触控板双指捏合以鼠标位置为中心缩放;工具栏提供缩放、适应画布和全屏;全屏沿用编辑器的窗口内全屏及窗口控件避让,点击全屏按钮或按 Esc 退出并回到原列表位置- 鼠标移入脑图外框时显示尺寸手柄,右边缘调整宽度、下边缘调整高度、右下角同时调整宽高,触屏可直接拖动;调整的是块在文档中的尺寸,不改变内部画布缩放,原有块菜单宽高设置仍可使用;松手保存一次可撤销的修改,Esc 或指针取消恢复原尺寸- 尺寸手柄获得键盘焦点时,方向键按 10px 调整对应尺寸,Shift + 方向键按 1px 调整,仅作用于该手柄;只读、锁定及全屏状态不显示手柄,超级块的直接子块只提供高度手柄,宽度仍由超级块分栏分隔线调整-- 选中范围首节点后点击工具栏的概要按钮,再点击末端同级节点,创建连续范围的方括号概要;范围不能跨层、重叠或嵌套,移动端使用相同的点选方式+- 选中范围首节点后点击工具栏的概要按钮,再点击末端同级节点,创建连续范围的方括号概要;支持单节点及范围嵌套,范围可以包含但不能交叉,移动端使用相同的点选方式+- 不选节点也可点击概要按钮进入选择模式,在画布空白处框选;点击空白处后可逐个点选节点,移动端沿用点选及触摸框选,双指缩放仍可使用+- 批量预览按父节点及连续范围分组,父子同时选中时保留最外层节点,不吸收未选中的中间节点;跳过已有相同概要,交叉范围提示冲突,点击确认或按 Enter 一次提交全部概要,Esc 取消,文档更新取消待确认的选择- 选择概要范围时也可使用上下方向键选择末端节点,Enter 确认范围,Esc 取消- 双击概要文字或使用底部编辑按钮修改纯文本,Enter 保存、Esc 取消;底部面板支持配色与删除,Delete 和 Backspace 也可删除选中的概要,操作进入文档撤销记录-- 概要包围成员的可见子树,折叠后重新布局;概要文字和括号参与关系线避让、适应画布以及 HTML/PDF 预览的边界计算+- 概要包围成员的完整可见子树及内层概要的括号和标签,单节点也保留括号高度,折叠后由内到外重新布局;概要文字和括号参与关系线避让、适应画布以及 HTML/PDF 预览的边界计算- 本次不包含自由摆放节点## 数据与兼容性@@ -39,7 +41,7 @@带有非空标题的虚拟根转换为列表时,标题实体化为真实父项,新增父项、标题段落和子列表三个块,原顶层项移入该子列表。所有已有块 ID 和正文保留,原顶层项的父子关系相应调整;虚拟根样式、关系线端点和概要父节点迁移至新父项,移除 `rootTitle`。再次往返不会重复新增父项,撤销恢复转换前结构。无标题的虚拟根不新增这些块。-旧列表上的 `custom-sy-list-mindmap="1"` 标记仍受兼容处理,新脑图以专用块类型保存。`custom-sy-list-mindmap-data` 保存版本为 `1` 的节点样式和关系线配置。转换为列表保留该配置;折叠沿用节点的 `fold` 属性。未知版本或损坏的配置不会被自动覆盖,原正文仍可查看。+旧列表上的 `custom-sy-list-mindmap="1"` 标记仍受兼容处理,新脑图以专用块类型保存。`custom-sy-list-mindmap-data` 保存版本为 `1` 或 `2` 的节点样式、关系线和概要配置。转换为列表保留该配置;折叠沿用节点的 `fold` 属性。未知版本或损坏的配置不会被自动覆盖,原正文仍可查看。关系线可选的 `route` 字段使用独立的 `version: 1`,`points` 保存不超过 64 个控制点。每个控制点的 `x`、`y` 是相对两个节点中心插值位置的偏移,`t` 是沿路径长度计算的插值比例(0 到 1),坐标偏移的绝对值不超过 1000000。缺少 `route` 表示自动中间路径;双击线段手柄恢复时只删除该字段,保留文字、样式和端点连接点。关系线的可选 `fromAnchor`、`toAnchor` 分别保存起点和终点的手动连接位置,每项包含 `side`(`left`、`right`、`top` 或 `bottom`)和 `ratio`(0 到 1);缺少相应字段表示该端自动选择,元数据版本仍为 `1`,旧配置无需迁移。比例跟随节点尺寸,位置跟随节点布局;“恢复自动接入”只删除这两个字段,不删除 `route`。未知版本及损坏配置保留原值。布局变化时优先重新使用手动路径;若手动路径无法避障,则保留指定连接点并暂时显示自动中间路径;指定连接点也无法使用时,才暂时显示自动连接点。两类回退分别显示明确提示,保存的路径和连接点均保留,恢复可用布局后重新使用;只读交互视图也显示提示,打印可隐藏提示但采用相同的几何规则。拖动期间的外部刷新取消预览,提交前核对关系线快照,避免覆盖较新的配置。@@ -47,9 +49,9 @@修改前补齐折叠隐藏的列表内容。结构、正文和配置修改通过已有文档事务保存,并进入文档撤销记录。复制列表时,样式所关联的节点 ID 和关系线的端点随复制后的块 ID 一起更新。-版本 `1` 的元数据可选 `summaries` 数组保存概要,每项包含 `id`、所属父节点 `parentId`、按顺序排列的成员块 ID `nodeIds`、纯文本 `label` 和可选颜色 `color`。旧配置缺少该字段时表示没有概要,无需迁移;未知字段继续保留,损坏的概要配置不覆盖原值。括号坐标由布局派生,不持久化。转换为列表时保留该属性,转回脑图后恢复显示;概要文字不生成独立正文块,不参与正文全文搜索或块引用。+元数据的可选 `summaries` 数组保存概要,每项包含 `id`、所属父节点 `parentId`、按顺序排列的成员块 ID `nodeIds`、纯文本 `label` 和可选颜色 `color`。版本 `1` 保留原有互斥成员校验,缺少该字段时表示没有概要;创建首个嵌套概要时在同一次事务中升级为版本 `2`,允许同层范围包含及祖先分支包含,拒绝同层范围交叉。新版继续读取和编辑版本 `1`,仅打开、预览和导出不升级;旧版对版本 `2` 保留原始配置并显示源列表,不能完整编辑新版脑图配置。未知版本、扩展字段及损坏配置保留原值。升级只涉及脑图属性,不改变 `.sy` 节点类型、密文信封、AAD 或密钥,已有加密文档及历史继续经原有认证读取链路访问。括号坐标和包含关系由节点范围派生,不持久化。转换为列表时保留该属性,转回脑图后恢复显示;概要文字不生成独立正文块,不参与正文全文搜索或块引用。-复制时同步重映射概要的父节点和成员 ID。事务在修改前记录同级节点顺序,范围内部新增的节点自动纳入,范围外新增的节点不纳入。成员删除或移出后缩小范围,剩一个成员仍保留,全部移除后删除概要;范围被既有节点分隔时保留未移动成员最多的连续部分。普通列表编辑共用该规则,配置变化与原操作一起同步、撤销和重做,重放时使用记录的原始快照。+复制时同步重映射概要的父节点和成员 ID。事务在修改前记录同级节点顺序,范围内部新增的节点自动纳入,范围外新增的节点不纳入。成员删除或移出后缩小范围,剩一个成员仍保留,全部移除后删除概要;范围被既有节点分隔时保留未移动成员最多的连续部分。嵌套范围分别整理,不受概要数组顺序影响;结构编辑造成原内外层交叉时,内层保留与外层的交集,完全分离时各自保留。删除内层概要不删除节点或外层概要。批量创建先校验全部范围及选择时的成员与配置快照,通过后一次写入配置,不留下部分创建结果。普通列表编辑共用成员规则,配置变化与原操作一起同步、撤销和重做,重放时使用记录的原始快照。内核在文档事务完成结构修改后,按列表当前的完整节点树清理失效的样式及关系线,并将配置修改附加到同一事务的同步、撤销和重做记录中。普通列表编辑、其他窗口和通过文档事务执行的 API 删除共用此逻辑;同一事务内先删除再插入的节点及折叠后代不会被误清理。刷新脑图只读取配置,不执行清理;复制列表会过滤不属于副本的样式和关系线。未知版本及损坏配置保持原样。diff --git a/kernel/model/list_mindmap_migration_crypto_test.go b/kernel/model/list_mindmap_migration_crypto_test.goindex 1b52469f84..bde637dcec 100644--- a/kernel/model/list_mindmap_migration_crypto_test.go+++ b/kernel/model/list_mindmap_migration_crypto_test.go@@ -95,11 +95,27 @@ func TestMigrateLegacyMindmapsEncrypted(t *testing.T) {}oldDocID := ast.NewNodeID()oldTree := treenode.NewTree(boxID, "/"+oldDocID+".sy", "/Old list", "Old list")- _, oldSource := engine.Md2BlockDOMTree("- Secret root\n - Secret child\n", false)+ _, oldSource := engine.Md2BlockDOMTree("- Secret root\n - Secret child\n - Second child\n", false)oldList := firstContentBlock(oldSource.Root)oldList.Unlink()oldList.SetIALAttr(listMindmapViewAttr, "1")- oldList.SetIALAttr(listMindmapMetadataAttr, `{"version":1,"nodes":{},"relations":[]}`)+ legacySummary, err := os.ReadFile("testdata/list_mindmap_summary_v1.json")+ if err != nil {+ t.Fatal(err)+ }+ var legacyItems []string+ ast.Walk(oldList, func(node *ast.Node, entering bool) ast.WalkStatus {+ if entering && node.Type == ast.NodeListItem {+ legacyItems = append(legacyItems, node.ID)+ }+ return ast.WalkContinue+ })+ if len(legacyItems) != 3 {+ t.Fatalf("unexpected legacy fixture tree: %v", legacyItems)+ }+ legacyMetadata := strings.NewReplacer(`"root"`, `"`+legacyItems[0]+`"`,+ `"a"`, `"`+legacyItems[1]+`"`, `"b"`, `"`+legacyItems[2]+`"`).Replace(strings.TrimSpace(string(legacySummary)))+ oldList.SetIALAttr(listMindmapMetadataAttr, legacyMetadata)oldTree.Root.AppendChild(oldList)if _, err = filesys.WriteTree(oldTree); err != nil {t.Fatal(err)@@ -140,7 +156,8 @@ func TestMigrateLegacyMindmapsEncrypted(t *testing.T) {t.Fatal(err)}_, _, oldContent, _, err := GetDocHistoryContent(oldRelative, "", false)- if err != nil || !strings.Contains(oldContent, `data-type="NodeList"`) || !strings.Contains(oldContent, "Secret root") {+ if err != nil || !strings.Contains(oldContent, `data-type="NodeList"`) || !strings.Contains(oldContent, "Secret root") ||+ !strings.Contains(oldContent, "Legacy summary") {t.Fatalf("encrypted old list history cannot recover the source: %v", err)}corrupt, _ := os.ReadFile(path)diff --git a/kernel/model/testdata/list_mindmap_summary_v1.json b/kernel/model/testdata/list_mindmap_summary_v1.jsonnew file mode 100644index 0000000000..909a1f7afd--- /dev/null+++ b/kernel/model/testdata/list_mindmap_summary_v1.json@@ -0,0 +1 @@+{"version":1,"rootTitle":"Legacy summary fixture","nodes":{"a":{"textColor":"red","extension":"keep"}},"relations":[{"id":"relation","from":"a","to":"b","label":"Legacy relation"}],"summaries":[{"id":"summary","parentId":"root","nodeIds":["a","b"],"label":"Legacy summary","color":"blue","extension":"keep"}],"extension":"keep"}diff --git a/kernel/model/transaction_list_mindmap.go b/kernel/model/transaction_list_mindmap.goindex 45d1c3c449..d467cb4524 100644--- a/kernel/model/transaction_list_mindmap.go+++ b/kernel/model/transaction_list_mindmap.go@@ -14,7 +14,7 @@ const listMindmapMetadataAttr = "custom-sy-list-mindmap-data"// 只校验当前版本的已知字段,未知字段随配置保留,损坏和较新版本的配置不参与清理。func validListMindmapMetadata(data map[string]any) bool {- if data["version"] != float64(1) {+ if data["version"] != float64(1) && data["version"] != float64(2) {return false}nodes, ok := data["nodes"].(map[string]any)@@ -30,7 +30,7 @@ func validListMindmapMetadata(data map[string]any) bool {return false}}- if summaries, exists := data["summaries"]; exists && !validListMindmapSummaries(summaries) {+ if summaries, exists := data["summaries"]; exists && !validListMindmapSummaries(summaries, data["version"] == float64(2)) {return false}validFields := func(value map[string]any, strings, numbers, booleans []string) bool {@@ -169,7 +169,8 @@ func pruneListMindmapMetadata(list *ast.Node, contexts ...*listMindmapSummaryConif len(contexts) > 0 {context = contexts[0]}- raw["summaries"], changed = normalizeListMindmapSummaries(summaries, listMindmapSiblingIDs(list), context)+ raw["summaries"], changed = normalizeListMindmapSummaries(summaries, listMindmapSiblingIDs(list), context,+ data["version"] == float64(2))}nodes := data["nodes"].(map[string]any)for id := range nodes {diff --git a/kernel/model/transaction_list_mindmap_test.go b/kernel/model/transaction_list_mindmap_test.goindex c91029a8b5..66a5af07cf 100644--- a/kernel/model/transaction_list_mindmap_test.go+++ b/kernel/model/transaction_list_mindmap_test.go@@ -176,7 +176,7 @@ func TestPruneListMindmapExcludesListsInsideContentBlocks(t *testing.T) {func TestPruneListMindmapPreservesInvalidMetadata(t *testing.T) {for _, value := range []string{- `broken`, `null`, `{"version":2,"nodes":{"deleted":{}},"relations":[]}`,+ `broken`, `null`, `{"version":3,"nodes":{"deleted":{}},"relations":[]}`,`{"version":1,"nodes":{"deleted":{"bold":"true"}},"relations":[]}`,`{"version":1,"nodes":{},"relations":[{"id":"r","from":"a","to":"b"}]}`,`{"version":1,"nodes":{},"relations":[{"id":"r","from":"a","to":"b","label":""},{"id":"r","from":"b","to":"a","label":""}]}`,diff --git a/kernel/model/transaction_mindmap_summary.go b/kernel/model/transaction_mindmap_summary.goindex 502e2aa5f3..67ad0a7779 100644--- a/kernel/model/transaction_mindmap_summary.go+++ b/kernel/model/transaction_mindmap_summary.go@@ -3,6 +3,7 @@ package modelimport ("encoding/json""slices"+ "sort""github.com/88250/lute/ast""github.com/88250/lute/parse"@@ -13,7 +14,7 @@ type listMindmapSummaryContext struct {moved map[string]bool}-func validListMindmapSummaries(value any) bool {+func validListMindmapSummaries(value any, nested bool) bool {summaries, ok := value.([]any)if !ok {return false@@ -45,12 +46,33 @@ func validListMindmapSummaries(value any) bool {if !ok || len(nodes) == 0 {return false}+ local := map[string]bool{}for _, value := range nodes {id, ok = value.(string)- if !ok || id == "" || id == parent || members[id] {+ if !ok || id == "" || id == parent || local[id] || (!nested && members[id]) {return false}members[id] = true+ local[id] = true+ }+ }+ if nested {+ for i, value := range summaries {+ a := value.(map[string]any)+ for _, value := range summaries[i+1:] {+ b := value.(map[string]any)+ if a["parentId"] == b["parentId"] {+ common := 0+ for _, id := range a["nodeIds"].([]any) {+ if slices.Contains(b["nodeIds"].([]any), id) {+ common+++ }+ }+ if common > 0 && common < len(a["nodeIds"].([]any)) && common < len(b["nodeIds"].([]any)) {+ return false+ }+ }+ }}}return true@@ -110,7 +132,7 @@ func (tx *Transaction) captureListMindmapSummarySiblings(tree *parse.Tree) {// 仅改写概要成员,未知字段保留原始 JSON 精度,范围消失时随事务删除概要。func normalizeListMindmapSummaries(raw json.RawMessage, siblings map[string][]string,- context *listMindmapSummaryContext) (json.RawMessage, bool) {+ context *listMindmapSummaryContext, nested bool) (json.RawMessage, bool) {var summaries []map[string]json.RawMessageif json.Unmarshal(raw, &summaries) != nil {return raw, false@@ -125,6 +147,14 @@ func normalizeListMindmapSummaries(raw json.RawMessage, siblings map[string][]stkept := make([]map[string]json.RawMessage, 0, len(summaries))claimed := map[string]bool{}changed := false+ type normalizedRange struct {+ summary map[string]json.RawMessage+ id string+ parent string+ original []string+ members []string+ }+ var ranges []*normalizedRangefor _, summary := range summaries {var parent stringvar members []string@@ -161,7 +191,7 @@ func normalizeListMindmapSummaries(raw json.RawMessage, siblings map[string][]stgroup = nil}for _, id := range siblings[parent] {- if !claimed[id] && (memberSet[id] || !old[id]) {+ if (nested || !claimed[id]) && (memberSet[id] || !old[id]) {group = append(group, id)} else {finish()@@ -180,6 +210,38 @@ func normalizeListMindmapSummaries(raw json.RawMessage, siblings map[string][]stchanged = true}kept = append(kept, summary)+ var id string+ _ = json.Unmarshal(summary["id"], &id)+ ranges = append(ranges, &normalizedRange{summary: summary, id: id, parent: parent, original: members, members: best})+ }+ if nested {+ sort.Slice(ranges, func(i, j int) bool {+ if len(ranges[i].original) != len(ranges[j].original) {+ return len(ranges[i].original) > len(ranges[j].original)+ }+ return ranges[i].id < ranges[j].id+ })+ // 结构编辑造成交叉时,内层范围保留与原外层的交集,范围完全分离时各自保留。+ for i, outer := range ranges {+ for _, inner := range ranges[i+1:] {+ if outer.parent != inner.parent || slices.ContainsFunc(inner.original, func(id string) bool {+ return !slices.Contains(outer.original, id)+ }) {+ continue+ }+ var common []string+ for _, id := range inner.members {+ if slices.Contains(outer.members, id) {+ common = append(common, id)+ }+ }+ if len(common) > 0 && len(common) < len(inner.members) && len(common) < len(outer.members) {+ inner.members = common+ inner.summary["nodeIds"], _ = json.Marshal(common)+ changed = true+ }+ }+ }}if !changed {return raw, falsediff --git a/kernel/model/transaction_mindmap_summary_test.go b/kernel/model/transaction_mindmap_summary_test.goindex 307a40e873..91634fdde5 100644--- a/kernel/model/transaction_mindmap_summary_test.go+++ b/kernel/model/transaction_mindmap_summary_test.go@@ -2,6 +2,7 @@ package modelimport ("encoding/json"+ "os""slices""strings""testing"@@ -29,7 +30,7 @@ func TestMindmapSummaryMembership(t *testing.T) {t.Run(tc.name, func(t *testing.T) {next, _ := normalizeListMindmapSummaries(raw, map[string][]string{"root": tc.current},&listMindmapSummaryContext{previous: map[string][]string{"root": {"a", "b", "c", "d"}},- moved: map[string]bool{tc.moved: true}})+ moved: map[string]bool{tc.moved: true}}, false)var summaries []struct {NodeIDs []string `json:"nodeIds"`}@@ -48,6 +49,70 @@ func TestMindmapSummaryMembership(t *testing.T) {}}+func TestMindmapSummaryNestedVersionCompatibility(t *testing.T) {+ fixture, err := os.ReadFile("testdata/list_mindmap_summary_v1.json")+ if err != nil {+ t.Fatal(err)+ }+ var data map[string]any+ if err = json.Unmarshal(fixture, &data); err != nil || !validListMindmapMetadata(data) {+ t.Fatalf("legacy fixture rejected: %v", err)+ }+ const raw = `[{"id":"inner","parentId":"root","nodeIds":["a","b"],"label":"Inner","extension":9007199254740993},{"id":"outer","parentId":"root","nodeIds":["a","b","c"],"label":"Outer"}]`+ var summaries []any+ _ = json.Unmarshal([]byte(raw), &summaries)+ data["summaries"] = summaries+ if validListMindmapMetadata(data) {+ t.Fatal("version 1 accepted repeated members")+ }+ data["version"] = float64(2)+ if !validListMindmapMetadata(data) {+ t.Fatal("version 2 rejected nested members")+ }+ for _, reverse := range []bool{false, true} {+ var values []map[string]json.RawMessage+ _ = json.Unmarshal([]byte(raw), &values)+ if reverse {+ slices.Reverse(values)+ }+ original, _ := json.Marshal(values)+ before := map[string][]string{"root": {"a", "b", "c", "d"}}+ unchanged, changed := normalizeListMindmapSummaries(original, before, nil, true)+ if changed || string(unchanged) != string(original) {+ t.Fatalf("nested membership depends on order: %s", unchanged)+ }+ next, changed := normalizeListMindmapSummaries(original, map[string][]string{"root": {"a", "new", "b", "c", "d"}},+ &listMindmapSummaryContext{previous: before}, true)+ if !changed || !strings.Contains(string(next), `9007199254740993`) {+ t.Fatalf("nested insert lost data: %s", next)+ }+ var result []struct {+ ID string `json:"id"`+ Nodes []string `json:"nodeIds"`+ }+ _ = json.Unmarshal(next, &result)+ for _, summary := range result {+ want := []string{"a", "new", "b"}+ if summary.ID == "outer" {+ want = append(want, "c")+ }+ if !slices.Equal(summary.Nodes, want) {+ t.Fatalf("unexpected nested membership: %s", next)+ }+ }+ }+ for _, invalid := range []string{+ `[{"id":"a","parentId":"root","nodeIds":["a","b"],"label":""},{"id":"b","parentId":"root","nodeIds":["b","c"],"label":""}]`,+ `[{"id":"a","parentId":"root","nodeIds":["a","a"],"label":""}]`,+ } {+ _ = json.Unmarshal([]byte(invalid), &summaries)+ data["summaries"] = summaries+ if validListMindmapMetadata(data) {+ t.Fatalf("damaged nested metadata accepted: %s", invalid)+ }+ }+}+func TestMindmapSummaryInvalidMetadataPreserved(t *testing.T) {_, list, _ := mindmapTestTree()for _, summaries := range []string{@@ -66,47 +131,63 @@ func TestMindmapSummaryInvalidMetadataPreserved(t *testing.T) {}func TestMindmapSummaryTransactionsAndListRoundTrip(t *testing.T) {- tree, list, child := mindmapTestTree()- parent := child.Parent.Parent.ID- second := &ast.Node{Type: ast.NodeListItem, ID: "second"}- child.Parent.AppendChild(second)- original := `{"version":1,"nodes":{},"relations":[],"summaries":[{"id":"s","parentId":"` + parent +- `","nodeIds":["child","second"],"label":"Summary","extension":9007199254740993}]}`- list.SetIALAttr(listMindmapMetadataAttr, original)- tx := &Transaction{trees: map[string]*parse.Tree{tree.ID: tree},- DoOperations: []*Operation{{Action: "insert", ID: "new"}}, UndoOperations: []*Operation{{Action: "delete", ID: "new"}}}- tx.captureListMindmapSummarySiblings(tree)- child.InsertAfter(&ast.Node{Type: ast.NodeListItem, ID: "new"})- if ret := tx.normalizeListMindmapMetadata(); ret != nil {- t.Fatal(ret)- }- next := list.IALAttr(listMindmapMetadataAttr)- if !strings.Contains(next, `"nodeIds":["child","new","second"]`) || len(tx.DoOperations) != 2 || len(tx.UndoOperations) != 2 {- t.Fatalf("insert did not update and broadcast summary: %s", next)- }- var attrs map[string]string- _ = json.Unmarshal([]byte(tx.UndoOperations[0].Data.(string)), &attrs)- if attrs[listMindmapMetadataAttr] != original {- t.Fatal("undo did not retain the original summary")- }- // 转换块类型和折叠不改变成员或概要文字。- ast.Walk(list, func(node *ast.Node, entering bool) ast.WalkStatus {- if entering {- if node.Type == ast.NodeList {- node.Type = ast.NodeMindmap- } else if node.Type == ast.NodeListItem {- node.Type = ast.NodeMindmapItem- node.SetIALAttr("fold", "1")+ for _, version := range []int{1, 2} {+ t.Run(string(rune('0'+version)), func(t *testing.T) {+ tree, list, child := mindmapTestTree()+ parent := child.Parent.Parent.ID+ second := &ast.Node{Type: ast.NodeListItem, ID: "second"}+ child.Parent.AppendChild(second)+ original := `{"version":1,"nodes":{},"relations":[],"summaries":[{"id":"s","parentId":"` + parent ++ `","nodeIds":["child","second"],"label":"Summary","extension":9007199254740993}]}`+ if version == 2 {+ original = strings.Replace(original, `"version":1`, `"version":2`, 1)+ original = strings.Replace(original, `}]}`, `},{"id":"inner","parentId":"`+parent++ `","nodeIds":["child"],"label":"Inner"}]}`, 1)}- }- return ast.WalkContinue- })- if ret, changed := pruneListMindmapMetadata(list); changed || ret != next {- t.Fatalf("type conversion or folding changed metadata: %s", ret)- }- tx.isReplay = true- child.Unlink()- if ret := tx.normalizeListMindmapMetadata(); ret != nil || list.IALAttr(listMindmapMetadataAttr) != next {- t.Fatal("replay rewrote the recorded summary snapshot")+ list.SetIALAttr(listMindmapMetadataAttr, original)+ tx := &Transaction{trees: map[string]*parse.Tree{tree.ID: tree},+ DoOperations: []*Operation{{Action: "insert", ID: "new"}}, UndoOperations: []*Operation{{Action: "delete", ID: "new"}}}+ tx.captureListMindmapSummarySiblings(tree)+ child.InsertAfter(&ast.Node{Type: ast.NodeListItem, ID: "new"})+ if ret := tx.normalizeListMindmapMetadata(); ret != nil {+ t.Fatal(ret)+ }+ next := list.IALAttr(listMindmapMetadataAttr)+ if !strings.Contains(next, `"nodeIds":["child","new","second"]`) || len(tx.DoOperations) != 2 || len(tx.UndoOperations) != 2 {+ t.Fatalf("insert did not update and broadcast summary: %s", next)+ }+ var attrs map[string]string+ _ = json.Unmarshal([]byte(tx.UndoOperations[0].Data.(string)), &attrs)+ if attrs[listMindmapMetadataAttr] != original {+ t.Fatal("undo did not retain the original summary")+ }+ _ = json.Unmarshal([]byte(tx.DoOperations[len(tx.DoOperations)-1].Data.(string)), &attrs)+ if attrs[listMindmapMetadataAttr] != next || !strings.Contains(next, "9007199254740993") {+ t.Fatal("redo lost the updated summary or extension precision")+ }+ if version == 2 && !strings.Contains(next, `"nodeIds":["child"]`) {+ t.Fatal("transaction lost the nested single-node summary")+ }+ // 转换块类型和折叠不改变成员或概要文字。+ ast.Walk(list, func(node *ast.Node, entering bool) ast.WalkStatus {+ if entering {+ if node.Type == ast.NodeList {+ node.Type = ast.NodeMindmap+ } else if node.Type == ast.NodeListItem {+ node.Type = ast.NodeMindmapItem+ node.SetIALAttr("fold", "1")+ }+ }+ return ast.WalkContinue+ })+ if ret, changed := pruneListMindmapMetadata(list); changed || ret != next {+ t.Fatalf("type conversion or folding changed metadata: %s", ret)+ }+ tx.isReplay = true+ child.Unlink()+ if ret := tx.normalizeListMindmapMetadata(); ret != nil || list.IALAttr(listMindmapMetadataAttr) != next {+ t.Fatal("replay rewrote the recorded summary snapshot")+ }+ })}}