Skip to content

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

:sparkles: Support mind map themes and batch colors https://github.com/siyuan-note/siyuan/issues/20800

Daniela94cc5053177
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 811e1bfc36..ef0afe75ce 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "متعدد الألوان",
+ "listMindmapPaletteSoft": "ناعم",
+ "listMindmapPaletteForest": "غابة",
+ "listMindmapCanvasBackground": "خلفية اللوحة",
+ "listMindmapClearManualColors": "مسح الألوان اليدوية",
+ "listMindmapLineColor": "لون خطوط الفروع",
"lockScreenWallpaper": "خلفية شاشة القفل",
"lockScreenWallpaperTip": "صورة واحدة بتنسيق JPEG أو PNG أو WebP، بحجم أقصى 10 MiB و16 ميغابكسل؛ تُحفظ في مساحة العمل هذه دون مزامنة وتظهر قبل تسجيل الدخول",
"automationCollectionIncludeSelf": "تضمين المستندات المحددة نفسها",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index 8da3073a6c..01fa0d1d3b 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Bunt",
+ "listMindmapPaletteSoft": "Sanft",
+ "listMindmapPaletteForest": "Wald",
+ "listMindmapCanvasBackground": "Hintergrund der Zeichenfläche",
+ "listMindmapClearManualColors": "Manuelle Farben löschen",
+ "listMindmapLineColor": "Farbe der Zweiglinien",
"lockScreenWallpaper": "Sperrbildschirm-Hintergrund",
"lockScreenWallpaperTip": "Ein JPEG-, PNG- oder WebP-Bild, maximal 10 MiB und 16 Megapixel; wird in diesem Arbeitsbereich ohne Synchronisierung gespeichert und vor der Anmeldung angezeigt",
"automationCollectionIncludeSelf": "Ausgewählte Dokumente selbst einschließen",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index c88529eded..e653fae997 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Colorful",
+ "listMindmapPaletteSoft": "Soft",
+ "listMindmapPaletteForest": "Forest",
+ "listMindmapCanvasBackground": "Canvas background",
+ "listMindmapClearManualColors": "Clear manual colors",
+ "listMindmapLineColor": "Branch line color",
"lockScreenWallpaper": "Lock screen wallpaper",
"lockScreenWallpaperTip": "One JPEG, PNG or WebP image, up to 10 MiB and 16 megapixels; stored in this workspace without sync and visible before login",
"automationCollectionIncludeSelf": "Include selected documents themselves",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 01f68e3d92..707cc7a873 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Multicolor",
+ "listMindmapPaletteSoft": "Suave",
+ "listMindmapPaletteForest": "Bosque",
+ "listMindmapCanvasBackground": "Fondo del lienzo",
+ "listMindmapClearManualColors": "Borrar colores manuales",
+ "listMindmapLineColor": "Color de las líneas de rama",
"lockScreenWallpaper": "Fondo de la pantalla de bloqueo",
"lockScreenWallpaperTip": "Una imagen JPEG, PNG o WebP, de hasta 10 MiB y 16 megapíxeles; se guarda en este espacio de trabajo sin sincronización y es visible antes de iniciar sesión",
"automationCollectionIncludeSelf": "Incluir los propios documentos seleccionados",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index 72101e4781..79df9c5725 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Multicolore",
+ "listMindmapPaletteSoft": "Doux",
+ "listMindmapPaletteForest": "Forêt",
+ "listMindmapCanvasBackground": "Arrière-plan du canevas",
+ "listMindmapClearManualColors": "Effacer les couleurs manuelles",
+ "listMindmapLineColor": "Couleur des lignes de branche",
"lockScreenWallpaper": "Fond d’écran de verrouillage",
"lockScreenWallpaperTip": "Une image JPEG, PNG ou WebP, de 10 MiB et 16 mégapixels maximum ; stockée dans cet espace de travail sans synchronisation et visible avant la connexion",
"automationCollectionIncludeSelf": "Inclure les documents sélectionnés eux-mêmes",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index 78c8886489..18784a3e96 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "צבעוני",
+ "listMindmapPaletteSoft": "רך",
+ "listMindmapPaletteForest": "יער",
+ "listMindmapCanvasBackground": "רקע הקנבס",
+ "listMindmapClearManualColors": "ניקוי צבעים ידניים",
+ "listMindmapLineColor": "צבע קווי הענפים",
"lockScreenWallpaper": "טפט מסך הנעילה",
"lockScreenWallpaperTip": "תמונת JPEG, PNG או WebP אחת, עד 10 MiB ו־16 מגה־פיקסל; נשמרת בסביבת עבודה זו ללא סנכרון וגלויה לפני הכניסה",
"automationCollectionIncludeSelf": "כלילת המסמכים שנבחרו עצמם",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index db45769ca2..eaa5ddf3d3 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "रंगीन",
+ "listMindmapPaletteSoft": "सौम्य",
+ "listMindmapPaletteForest": "वन",
+ "listMindmapCanvasBackground": "कैनवास की पृष्ठभूमि",
+ "listMindmapClearManualColors": "मैन्युअल रंग साफ़ करें",
+ "listMindmapLineColor": "शाखा रेखा का रंग",
"lockScreenWallpaper": "लॉक स्क्रीन वॉलपेपर",
"lockScreenWallpaperTip": "एक JPEG, PNG या WebP छवि, अधिकतम 10 MiB और 16 मेगापिक्सेल; इस कार्यक्षेत्र में बिना सिंक के सहेजी जाती है और लॉगिन से पहले दिखाई देती है",
"automationCollectionIncludeSelf": "चयनित दस्तावेज़ों को स्वयं शामिल करें",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index 09bbdf78b8..74116f5c53 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Warna-warni",
+ "listMindmapPaletteSoft": "Lembut",
+ "listMindmapPaletteForest": "Hutan",
+ "listMindmapCanvasBackground": "Latar belakang kanvas",
+ "listMindmapClearManualColors": "Hapus warna manual",
+ "listMindmapLineColor": "Warna garis cabang",
"lockScreenWallpaper": "Wallpaper layar kunci",
"lockScreenWallpaperTip": "Satu gambar JPEG, PNG, atau WebP, maksimal 10 MiB dan 16 megapiksel; disimpan di ruang kerja ini tanpa sinkronisasi dan terlihat sebelum masuk",
"automationCollectionIncludeSelf": "Sertakan dokumen yang dipilih itu sendiri",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index b42add84f9..b3701f675f 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Multicolore",
+ "listMindmapPaletteSoft": "Tenue",
+ "listMindmapPaletteForest": "Foresta",
+ "listMindmapCanvasBackground": "Sfondo della tela",
+ "listMindmapClearManualColors": "Cancella colori manuali",
+ "listMindmapLineColor": "Colore delle linee dei rami",
"lockScreenWallpaper": "Sfondo della schermata di blocco",
"lockScreenWallpaperTip": "Una sola immagine JPEG, PNG o WebP, fino a 10 MiB e 16 megapixel; salvata in questo spazio di lavoro senza sincronizzazione e visibile prima dell’accesso",
"automationCollectionIncludeSelf": "Includi i documenti selezionati stessi",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index fd4ba7675f..562f408222 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "カラフル",
+ "listMindmapPaletteSoft": "ソフト",
+ "listMindmapPaletteForest": "フォレスト",
+ "listMindmapCanvasBackground": "キャンバスの背景",
+ "listMindmapClearManualColors": "手動の配色をクリア",
+ "listMindmapLineColor": "枝線の色",
"lockScreenWallpaper": "ロック画面の壁紙",
"lockScreenWallpaperTip": "JPEG、PNG、WebP の画像を1枚保存できます(最大 10 MiB、1600万画素)。現在のワークスペースに保存され、同期されず、ログイン前に表示されます",
"automationCollectionIncludeSelf": "選択した文書自体を含める",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 146c46c76a..c22a895501 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "다채로운 색상",
+ "listMindmapPaletteSoft": "부드러운 색상",
+ "listMindmapPaletteForest": "숲",
+ "listMindmapCanvasBackground": "캔버스 배경",
+ "listMindmapClearManualColors": "수동 색상 지우기",
+ "listMindmapLineColor": "분기 연결선 색상",
"lockScreenWallpaper": "잠금 화면 배경화면",
"lockScreenWallpaperTip": "JPEG, PNG 또는 WebP 이미지 한 장, 최대 10 MiB 및 1,600만 화소; 현재 작업 공간에 저장되며 동기화되지 않고 로그인 전에 표시됨",
"automationCollectionIncludeSelf": "선택한 문서 자체 포함",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index e858c3d3e1..ae2ed1fe93 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Kleurrijk",
+ "listMindmapPaletteSoft": "Zacht",
+ "listMindmapPaletteForest": "Bos",
+ "listMindmapCanvasBackground": "Canvasachtergrond",
+ "listMindmapClearManualColors": "Handmatige kleuren wissen",
+ "listMindmapLineColor": "Kleur van taklijnen",
"lockScreenWallpaper": "Achtergrond van het vergrendelscherm",
"lockScreenWallpaperTip": "Eén JPEG-, PNG- of WebP-afbeelding, maximaal 10 MiB en 16 megapixel; opgeslagen in deze werkruimte zonder synchronisatie en zichtbaar vóór het aanmelden",
"automationCollectionIncludeSelf": "Geselecteerde documenten zelf opnemen",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 051f395513..d3904d5ed7 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Kolorowy",
+ "listMindmapPaletteSoft": "Łagodny",
+ "listMindmapPaletteForest": "Las",
+ "listMindmapCanvasBackground": "Tło płótna",
+ "listMindmapClearManualColors": "Wyczyść ręczne kolory",
+ "listMindmapLineColor": "Kolor linii gałęzi",
"lockScreenWallpaper": "Tapeta ekranu blokady",
"lockScreenWallpaperTip": "Jeden obraz JPEG, PNG lub WebP, do 10 MiB i 16 megapikseli; zapisany w tej przestrzeni roboczej bez synchronizacji i widoczny przed logowaniem",
"automationCollectionIncludeSelf": "Uwzględnij same wybrane dokumenty",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index a9c350da64..949a29722d 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Colorido",
+ "listMindmapPaletteSoft": "Suave",
+ "listMindmapPaletteForest": "Floresta",
+ "listMindmapCanvasBackground": "Fundo da tela",
+ "listMindmapClearManualColors": "Limpar cores manuais",
+ "listMindmapLineColor": "Cor das linhas dos ramos",
"lockScreenWallpaper": "Papel de parede da tela de bloqueio",
"lockScreenWallpaperTip": "Uma imagem JPEG, PNG ou WebP, de até 10 MiB e 16 megapixels; salva neste espaço de trabalho sem sincronização e visível antes do login",
"automationCollectionIncludeSelf": "Incluir os próprios documentos selecionados",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index a5fd57052e..d8a7c96180 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Разноцветная",
+ "listMindmapPaletteSoft": "Мягкая",
+ "listMindmapPaletteForest": "Лесная",
+ "listMindmapCanvasBackground": "Фон холста",
+ "listMindmapClearManualColors": "Сбросить ручные цвета",
+ "listMindmapLineColor": "Цвет линий ветвей",
"lockScreenWallpaper": "Обои экрана блокировки",
"lockScreenWallpaperTip": "Одно изображение JPEG, PNG или WebP, до 10 MiB и 16 мегапикселей; хранится в текущем рабочем пространстве без синхронизации и видно до входа",
"automationCollectionIncludeSelf": "Включать сами выбранные документы",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 6d65a93c39..9507ca3bd5 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Pestrá",
+ "listMindmapPaletteSoft": "Jemná",
+ "listMindmapPaletteForest": "Lesná",
+ "listMindmapCanvasBackground": "Pozadie plátna",
+ "listMindmapClearManualColors": "Vymazať ručné farby",
+ "listMindmapLineColor": "Farba čiar vetiev",
"lockScreenWallpaper": "Tapeta zamknutej obrazovky",
"lockScreenWallpaperTip": "Jeden obrázok JPEG, PNG alebo WebP, najviac 10 MiB a 16 megapixelov; uložený v tomto pracovnom priestore bez synchronizácie a viditeľný pred prihlásením",
"automationCollectionIncludeSelf": "Zahrnúť samotné vybrané dokumenty",
diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.json
index ffd185a532..3569fcef0e 100644
--- a/app/appearance/langs/sr.json
+++ b/app/appearance/langs/sr.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Шарено",
+ "listMindmapPaletteSoft": "Нежно",
+ "listMindmapPaletteForest": "Шума",
+ "listMindmapCanvasBackground": "Позадина платна",
+ "listMindmapClearManualColors": "Обриши ручно подешене боје",
+ "listMindmapLineColor": "Боја линија грана",
"lockScreenWallpaper": "Позадина закључаног екрана",
"lockScreenWallpaperTip": "Једна JPEG, PNG или WebP слика, до 10 MiB и 16 мегапиксела; чува се у овом радном простору без синхронизације и видљива је пре пријављивања",
"automationCollectionIncludeSelf": "Укључи саме изабране документе",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index 2af40d24b3..c90e5bc9c6 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "หลากสี",
+ "listMindmapPaletteSoft": "นุ่มนวล",
+ "listMindmapPaletteForest": "ป่า",
+ "listMindmapCanvasBackground": "พื้นหลังผืนผ้าใบ",
+ "listMindmapClearManualColors": "ล้างสีที่กำหนดเอง",
+ "listMindmapLineColor": "สีเส้นกิ่ง",
"lockScreenWallpaper": "ภาพพื้นหลังหน้าจอล็อก",
"lockScreenWallpaperTip": "ภาพ JPEG, PNG หรือ WebP หนึ่งภาพ ขนาดไม่เกิน 10 MiB และ 16 ล้านพิกเซล บันทึกในพื้นที่ทำงานนี้โดยไม่ซิงค์และมองเห็นได้ก่อนเข้าสู่ระบบ",
"automationCollectionIncludeSelf": "รวมตัวเอกสารที่เลือกด้วย",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index 9d2f372c55..1e3ee98779 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Renkli",
+ "listMindmapPaletteSoft": "Yumuşak",
+ "listMindmapPaletteForest": "Orman",
+ "listMindmapCanvasBackground": "Tuval arka planı",
+ "listMindmapClearManualColors": "Elle ayarlanan renkleri temizle",
+ "listMindmapLineColor": "Dal çizgisi rengi",
"lockScreenWallpaper": "Kilit ekranı duvar kâğıdı",
"lockScreenWallpaperTip": "En fazla 10 MiB ve 16 megapiksel boyutunda tek bir JPEG, PNG veya WebP görüntüsü; bu çalışma alanında eşitleme yapılmadan saklanır ve girişten önce görünür",
"automationCollectionIncludeSelf": "Seçilen belgelerin kendilerini dahil et",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 455def04cc..6e1d18cbd7 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "Барвиста",
+ "listMindmapPaletteSoft": "М’яка",
+ "listMindmapPaletteForest": "Лісова",
+ "listMindmapCanvasBackground": "Тло полотна",
+ "listMindmapClearManualColors": "Скинути ручні кольори",
+ "listMindmapLineColor": "Колір ліній гілок",
"lockScreenWallpaper": "Шпалери екрана блокування",
"lockScreenWallpaperTip": "Одне зображення JPEG, PNG або WebP, до 10 MiB і 16 мегапікселів; зберігається в поточному робочому просторі без синхронізації та видиме до входу",
"automationCollectionIncludeSelf": "Включати самі вибрані документи",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index d86dd53aad..2828fae7d5 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "缤纷",
+ "listMindmapPaletteSoft": "柔和",
+ "listMindmapPaletteForest": "森林",
+ "listMindmapCanvasBackground": "画布背景",
+ "listMindmapClearManualColors": "清除手工配色",
+ "listMindmapLineColor": "分支连线颜色",
"lockScreenWallpaper": "锁屏壁纸",
"lockScreenWallpaperTip": "仅保留一张 JPEG、PNG 或 WebP 图片,最大 10 MiB、1600 万像素;保存在当前工作空间,不参与同步,登录前可见",
"automationCollectionIncludeSelf": "包含所选文档自身",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 10cd804456..d2ff395cc0 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,10 @@
{
+ "listMindmapPaletteColorful": "繽紛",
+ "listMindmapPaletteSoft": "柔和",
+ "listMindmapPaletteForest": "森林",
+ "listMindmapCanvasBackground": "畫布背景",
+ "listMindmapClearManualColors": "清除手動配色",
+ "listMindmapLineColor": "分支連線顏色",
"lockScreenWallpaper": "鎖定畫面桌布",
"lockScreenWallpaperTip": "僅保留一張 JPEG、PNG 或 WebP 圖片,最大 10 MiB、1600 萬像素;儲存在目前工作空間,不參與同步,登入前可見",
"automationCollectionIncludeSelf": "包含所選文件本身",
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy
index 3fe9158617..4f68b58937 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy
@@ -8,7 +8,7 @@
"title": "Formatting elements",
"title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;",
"type": "doc",
- "updated": "20261021132218"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2088,7 +2088,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017110432-mq248cg",
- "updated": "20261020162345"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2107,7 +2107,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "Connectors"
+ "TextMarkTextContent": "Appearance"
},
{
"Type": "NodeText",
@@ -2120,7 +2120,7 @@
},
{
"Type": "NodeText",
- "Data": " to select Curved fork, Orthogonal, Curved fan, or Rounded orthogonal. The choice applies to the whole map, is saved with the document, and supports undo and redo. It changes parent-child connectors without moving nodes or changing relationship lines. Orthogonal styles use a shared vertical trunk in the default line color; the trunk cannot be selected separately, while horizontal branches can still be selected and colored individually. SiYuan-format HTML and PDF previews use the saved style."
+ "Data": " to select Curved fork, Orthogonal, Curved fan, or Rounded orthogonal. The choice applies to the whole map, is saved with the document, and supports undo and redo. It changes parent-child connectors without moving nodes or changing relationship lines. Shared trunks cannot be selected separately; with a palette enabled, they follow their parent branch color. Horizontal branches can still be selected and colored individually. SiYuan-format HTML and PDF previews use the saved style."
}
]
},
@@ -2129,7 +2129,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017113512-rxzvh9f",
- "updated": "20261017113835"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2139,7 +2139,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "Connectors"
+ "TextMarkTextContent": "More"
},
{
"Type": "NodeText",
@@ -2156,6 +2156,129 @@
}
]
},
+ {
+ "ID": "20261022102848-11epv5y",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-11epv5y",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Use "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "More"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Appearance"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Theme"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " to choose Colorful, Soft, or Forest for the current map. First-level branches receive colors from the palette, and descendants inherit their branch color. Reordering branches preserves their assigned colors. New nodes follow the map's palette automatically. Manual node and line colors are retained. Choosing Default removes the palette while preserving manual colors and the canvas background. The theme does not change node content, structure, or folding states."
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-3decujr",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-3decujr",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Use "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "More"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Appearance"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Canvas background"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " to choose a solid canvas background, or Default to follow the application theme. Use "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "More"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Appearance"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "Clear manual colors"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " to remove manual colors from nodes, hierarchy lines, relationship lines, and summaries so that palette or default colors apply again. This does not reset the canvas background or other formatting. Appearance changes are saved with the document, support undo and redo, and are included in SiYuan-format HTML and PDF previews."
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-5nohuq1",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-5nohuq1",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Select multiple nodes, then use the bottom palette to change their text and background colors together. The branch line palette changes the incoming hierarchy lines of the selected nodes. Each batch change can be undone in one step. Choose Default in a palette to restore the theme or default colors. On touch screens, use the multiple-selection button in the bottom node menu to select the nodes."
+ }
+ ]
+ },
{
"ID": "20261003225941-mxlfdrn",
"Type": "NodeParagraph",
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy
index 25bc023337..05edaf64d5 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy
@@ -8,7 +8,7 @@
"title": "排版元素",
"title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);",
"type": "doc",
- "updated": "20261021132218"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2091,7 +2091,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017110432-6mghas7",
- "updated": "20261020162345"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2110,7 +2110,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "连线"
+ "TextMarkTextContent": "外观"
},
{
"Type": "NodeText",
@@ -2123,7 +2123,7 @@
},
{
"Type": "NodeText",
- "Data": " 中选择曲线分叉、正交折线、曲线汇聚或圆角折线。选择应用于整张脑图,随文档保存,并支持撤销和重做。切换只改变父子节点间的连线,不改变节点位置或关系线。正交样式共用的竖线沿用默认线色,不单独选中;横向分支仍可单独选中和配色。思源格式的 HTML 和 PDF 预览使用保存的样式。"
+ "Data": " 中选择曲线分叉、正交折线、曲线汇聚或圆角折线。选择应用于整张脑图,随文档保存,并支持撤销和重做。切换只改变父子节点间的连线,不改变节点位置或关系线。共用主干不能单独选中,启用色卡后跟随所属父分支的颜色;横向分支仍可单独选中和配色。思源格式的 HTML 和 PDF 预览使用保存的样式。"
}
]
},
@@ -2132,7 +2132,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017113512-kojg0bw",
- "updated": "20261017113835"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2142,7 +2142,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "连线"
+ "TextMarkTextContent": "更多"
},
{
"Type": "NodeText",
@@ -2159,6 +2159,129 @@
}
]
},
+ {
+ "ID": "20261022102848-idam1p2",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-idam1p2",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "更多"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "外观"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "主题"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中为当前导图选择缤纷、柔和或森林配色。一级分支按色卡分配颜色,后代节点继承所属分支的颜色;调整分支顺序会保留原有配色,新增节点自动跟随导图配色。已有的节点和线条手工配色会保留。选择默认可移除色卡,并保留手工配色和画布背景。主题不会改变节点内容、结构或折叠状态。"
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-m1dh0tw",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-m1dh0tw",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "更多"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "外观"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "画布背景"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中选择纯色背景,选择默认则跟随应用主题。在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "更多"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "外观"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "清除手工配色"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中清除节点、层级连线、关系线和概要的手工配色,恢复使用色卡或默认颜色;画布背景和其他格式保持不变。外观随文档保存,支持撤销和重做,并用于思源格式的 HTML 和 PDF 预览。"
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-xfgxiox",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-xfgxiox",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "选中多个节点后,可用底部色板统一修改文字和背景颜色,也可用分支连线色板修改所选节点的入线颜色。每次批量修改均可一次撤销。在对应色板中选择默认,可恢复主题或默认配色。触屏上可使用底部节点菜单的多选按钮选择多个节点。"
+ }
+ ]
+ },
{
"ID": "20261003225941-hge6x3e",
"Type": "NodeParagraph",
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy
index 9ea5c9ac0b..d4ebe3a8e7 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy
@@ -8,7 +8,7 @@
"title": "排版元素",
"title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);",
"type": "doc",
- "updated": "20261021132218"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2089,7 +2089,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017110432-qnsdugf",
- "updated": "20261020162345"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2108,7 +2108,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "連線"
+ "TextMarkTextContent": "外觀"
},
{
"Type": "NodeText",
@@ -2121,7 +2121,7 @@
},
{
"Type": "NodeText",
- "Data": " 中選擇曲線分岔、直角折線、曲線匯聚或圓角折線。選擇套用至整張心智圖,隨文件儲存,並支援復原和重做。切換只改變父子節點間的連線,不改變節點位置或關係線。直角樣式共用的垂直線沿用預設線色,不能單獨選取;水平分支仍可單獨選取和配色。思源格式的 HTML 與 PDF 預覽使用儲存的樣式。"
+ "Data": " 中選擇曲線分岔、直角折線、曲線匯聚或圓角折線。選擇套用至整張心智圖,隨文件儲存,並支援復原和重做。切換只改變父子節點間的連線,不改變節點位置或關係線。共用主幹不能單獨選取,啟用色卡後跟隨所屬父分支的顏色;水平分支仍可單獨選取和配色。思源格式的 HTML 與 PDF 預覽使用儲存的樣式。"
}
]
},
@@ -2130,7 +2130,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017113512-z8j1a4z",
- "updated": "20261017113835"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2140,7 +2140,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "連線"
+ "TextMarkTextContent": "更多"
},
{
"Type": "NodeText",
@@ -2157,6 +2157,129 @@
}
]
},
+ {
+ "ID": "20261022102848-dz75ii8",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-dz75ii8",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "更多"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "外觀"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "主題"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中為目前心智圖選擇繽紛、柔和或森林配色。一級分支依色卡分配顏色,後代節點繼承所屬分支的顏色;調整分支順序會保留原有配色,新增節點自動跟隨心智圖配色。既有的節點和線條手動配色會保留。選擇預設可移除色卡,並保留手動配色和畫布背景。主題不會改變節點內容、結構或摺疊狀態。"
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-z2ij065",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-z2ij065",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "更多"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "外觀"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "畫布背景"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中選擇純色背景,選擇預設則跟隨應用程式主題。在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "更多"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "外觀"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "清除手動配色"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中清除節點、階層連線、關係線和概要的手動配色,恢復使用色卡或預設顏色;畫布背景和其他格式保持不變。外觀隨文件儲存,支援復原和重做,並用於思源格式的 HTML 與 PDF 預覽。"
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-bttpd92",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-bttpd92",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "選取多個節點後,可用底部色板統一修改文字和背景顏色,也可用分支連線色板修改所選節點的入線顏色。每次批次修改均可一次復原。在對應色板中選擇預設,可恢復主題或預設配色。觸控螢幕上可使用底部節點選單的多選按鈕選取多個節點。"
+ }
+ ]
+ },
{
"ID": "20261003225941-6yr63oi",
"Type": "NodeParagraph",
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy
index 4e0b94505a..3c9741e16a 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy
@@ -9,7 +9,7 @@
"title": "書式要素",
"title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;",
"type": "doc",
- "updated": "20261021132218"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2235,7 +2235,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017110432-562ro9u",
- "updated": "20261020162345"
+ "updated": "20261022102848"
},
"Children": [
{
@@ -2254,7 +2254,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "接続線"
+ "TextMarkTextContent": "スタイル"
},
{
"Type": "NodeText",
@@ -2267,7 +2267,7 @@
},
{
"Type": "NodeText",
- "Data": " を開き、分岐曲線、直角線、扇形曲線、角丸直角線から選択できます。選択はマップ全体に適用され、文書とともに保存され、取り消しとやり直しに対応します。親子ノード間の接続線のみを変更し、ノードの位置や関連線は変更しません。直角のスタイルでは共通の縦線に既定の線色を使用し、縦線を個別に選択することはできません。横方向の分岐は個別に選択して色を変更できます。SiYuan 形式の HTML と PDF プレビューには保存したスタイルが反映されます。"
+ "Data": " を開き、分岐曲線、直角線、扇形曲線、角丸直角線から選択できます。選択はマップ全体に適用され、文書とともに保存され、取り消しとやり直しに対応します。親子ノード間の接続線のみを変更し、ノードの位置や関連線は変更しません。共通の幹線は個別に選択できず、パレットを有効にすると親ブランチの色に従います。横方向の分岐は個別に選択して色を変更できます。SiYuan 形式の HTML と PDF プレビューには保存したスタイルが反映されます。"
}
]
},
@@ -2276,13 +2276,13 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261017113512-geqkoea",
- "updated": "20261017113835"
+ "updated": "20261022102848"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
- "TextMarkTextContent": "接続線"
+ "TextMarkTextContent": "詳細"
},
{
"Type": "NodeText",
@@ -2299,6 +2299,121 @@
}
]
},
+ {
+ "ID": "20261022102848-sbqeaum",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-sbqeaum",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "詳細"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "スタイル"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "テーマ"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " で、現在のマップにカラフル、ソフト、フォレストの配色を選択できます。第 1 階層のブランチにパレットの色を割り当て、子孫ノードは所属するブランチの色を継承します。並べ替えても割り当てた色は保持され、新しいノードも配色に従います。手動で設定したノードや線の色は保持されます。デフォルトを選ぶとパレットを解除し、手動の色と背景は保持します。テーマはノードの内容、構造、折りたたみ状態を変更しません。"
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-lteviyd",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-lteviyd",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "詳細"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "スタイル"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "キャンバスの背景"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " で単色の背景を選択できます。デフォルトではアプリのテーマに従います。"
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "詳細"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "スタイル"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " - "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "kbd",
+ "TextMarkTextContent": "手動の配色をクリア"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " で、ノード、階層の接続線、関連線、要約の手動配色を解除し、パレットまたは既定の色に戻せます。背景とその他の書式は保持されます。外観は文書とともに保存され、取り消しとやり直しに対応し、SiYuan 形式の HTML と PDF プレビューにも反映されます。"
+ }
+ ]
+ },
+ {
+ "ID": "20261022102848-vdgjx9w",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261022102848-vdgjx9w",
+ "updated": "20261022102848"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "複数のノードを選択すると、下部のパレットで文字色と背景色をまとめて変更できます。枝線のパレットでは、選択したノードに入る階層の接続線の色を変更できます。一括変更は一度の取り消しで元に戻せます。パレットでデフォルトを選ぶと、テーマまたは既定の色に戻ります。タッチ画面では、下部のノードメニューにある複数選択ボタンでノードを選択できます。"
+ }
+ ]
+ },
{
"ID": "20261003225941-37evcb1",
"Type": "NodeParagraph",
diff --git a/app/src/protyle/render/listMindmap/appearance.test.ts b/app/src/protyle/render/listMindmap/appearance.test.ts
new file mode 100644
index 0000000000..00048a0bb0
--- /dev/null
+++ b/app/src/protyle/render/listMindmap/appearance.test.ts
@@ -0,0 +1,94 @@
+import * as assert from "node:assert/strict";
+import test from "node:test";
+import {assignListMindmapBranchColors, clearListMindmapManualColors, getListMindmapAppearanceMenu,
+ getMindmapTextColor, isListMindmapAppearance, LIST_MINDMAP_PALETTES, resolveListMindmapColors} from "./appearance";
+import type {ListMindmapModel, ListMindmapNode} from "./model";
+
+const makeModel = (): ListMindmapModel => {
+ const node = (id: string, children: ListMindmapNode[] = []): ListMindmapNode =>
+ ({id, children, contentBlocks: [], collapsed: false, virtual: false});
+ const root = node("root", [node("a", [node("a1")]), node("b", [node("b1")])]);
+ const nodes = new Map<string, ListMindmapNode>();
+ const visit = (item: ListMindmapNode) => {
+ nodes.set(item.id, item);
+ item.children.forEach(child => { child.parentId = item.id; visit(child); });
+ };
+ visit(root);
+ return {list: undefined, root, nodes, metadata: {version: 1, nodes: {}, relations: []}};
+};
+
+test("appearance validates optional colors and rejects unsupported formats", () => {
+ assert.ok(isListMindmapAppearance({version: 1, palette: [], extension: "retained"}));
+ for (const preset of LIST_MINDMAP_PALETTES) {
+ assert.ok(isListMindmapAppearance({version: 1, palette: preset.colors, backgroundColor: "#AABBCC"}));
+ }
+ for (const value of [null, [], {}, {version: 2, palette: []}, {version: 1, palette: "red"},
+ {version: 1, palette: ["red"]}, {version: 1, palette: Array(25).fill("#123456")},
+ {version: 1, palette: [], backgroundColor: null}, {version: 1, palette: [], backgroundColor: "url(x)"}]) {
+ assert.equal(isListMindmapAppearance(value), false);
+ }
+});
+
+test("branch identity survives reordering, theme changes, insertion, reparenting and serialized reload", () => {
+ const model = makeModel();
+ const before = JSON.stringify(model.metadata);
+ assert.equal(assignListMindmapBranchColors(model), false);
+ assert.equal(resolveListMindmapColors(model).size, 0);
+ assert.equal(JSON.stringify(model.metadata), before, "legacy maps are never styled implicitly");
+ model.metadata.appearance = {version: 1, palette: [...LIST_MINDMAP_PALETTES[0].colors]};
+ assert.equal(assignListMindmapBranchColors(model), true);
+ assert.equal(assignListMindmapBranchColors(model), false);
+ const first = resolveListMindmapColors(model);
+ assert.deepEqual(first.get("a"), first.get("a1"));
+ assert.notEqual(first.get("a").backgroundColor, first.get("b").backgroundColor);
+ model.root.children.reverse();
+ model.metadata = JSON.parse(JSON.stringify(model.metadata));
+ assert.deepEqual(resolveListMindmapColors(model), first);
+ model.metadata.appearance.palette = [...LIST_MINDMAP_PALETTES[1].colors];
+ assert.equal(resolveListMindmapColors(model).get("a").backgroundColor, LIST_MINDMAP_PALETTES[1].colors[0]);
+ const added = {...model.root.children[0], id: "new", children: [] as ListMindmapNode[]};
+ model.root.children.unshift(added);
+ assert.equal(assignListMindmapBranchColors(model), true);
+ assert.equal(model.metadata.nodes.new.branchColor, 2);
+ assert.equal(model.metadata.nodes.a.branchColor, 0);
+ const a1 = model.nodes.get("a1");
+ model.nodes.get("a").children = [];
+ model.nodes.get("b").children.push(a1);
+ a1.parentId = "b";
+ assert.deepEqual(resolveListMindmapColors(model).get("b"), resolveListMindmapColors(model).get("a1"));
+ for (const color of ["#000000", "#166534", "#2563eb"]) {
+ assert.equal(getMindmapTextColor(color), "#ffffff");
+ }
+ for (const color of ["#ffffff", "#bfdbfe", "#fecaca"]) {
+ assert.equal(getMindmapTextColor(color), "#000000");
+ }
+});
+
+test("appearance menu preserves manual colors and non-color metadata until explicit reset", () => {
+ const model = makeModel();
+ model.metadata.nodes.a = {textColor: "red", backgroundColor: "blue", lineColor: "green", bold: true};
+ model.metadata.relations.push({id: "r", from: "a", to: "b", label: "Keep", color: "red", width: 3});
+ model.metadata.summaries = [{id: "s", parentId: "root", nodeIds: ["a"], label: "Keep", color: "blue"}];
+ const old = JSON.stringify(model.metadata.nodes);
+ const labels = {appearance: "Appearance", theme: "Theme", default: "Default"};
+ const change = (update: (data: typeof model.metadata) => void) => update(model.metadata);
+ const build = () => getListMindmapAppearanceMenu(model.metadata, change, labels, {id: "connectorStyle", label: "Connectors"});
+ const choose = (group: string, id: string) => {
+ const entries = (build().submenu as IMenu[]).find(item => item.id === group).submenu as IMenu[];
+ entries.find(item => item.id === id).click(undefined, undefined);
+ };
+ choose("theme", "forest");
+ assert.equal(JSON.stringify(model.metadata.nodes), old);
+ choose("canvasBackground", "dark");
+ assert.equal(model.metadata.appearance.backgroundColor, "#1e1e1e");
+ choose("theme", "soft");
+ assert.equal(model.metadata.appearance.backgroundColor, "#1e1e1e");
+ choose("theme", "default");
+ assert.equal(resolveListMindmapColors(model).size, 0);
+ clearListMindmapManualColors(model.metadata);
+ assert.deepEqual(model.metadata.nodes.a, {bold: true});
+ assert.deepEqual(model.metadata.relations[0], {id: "r", from: "a", to: "b", label: "Keep", width: 3});
+ assert.equal(model.metadata.summaries[0].label, "Keep");
+ assert.equal(model.metadata.summaries[0].color, undefined);
+ assert.equal(model.metadata.appearance.backgroundColor, "#1e1e1e");
+});
diff --git a/app/src/protyle/render/listMindmap/appearance.ts b/app/src/protyle/render/listMindmap/appearance.ts
new file mode 100644
index 0000000000..cd43bcdeb1
--- /dev/null
+++ b/app/src/protyle/render/listMindmap/appearance.ts
@@ -0,0 +1,125 @@
+import type {ListMindmapMetadata, ListMindmapModel, ListMindmapNodeStyle} from "./model";
+
+export interface ListMindmapAppearance {
+ version: 1;
+ palette: string[];
+ backgroundColor?: string;
+}
+
+export const LIST_MINDMAP_PALETTES = [
+ {id: "colorful", label: "listMindmapPaletteColorful", colors: ["#2563eb", "#dc2626", "#15803d", "#9333ea", "#c2410c", "#0e7490"]},
+ {id: "soft", label: "listMindmapPaletteSoft", colors: ["#bfdbfe", "#fecaca", "#bbf7d0", "#e9d5ff", "#fed7aa", "#a5f3fc"]},
+ {id: "forest", label: "listMindmapPaletteForest", colors: ["#166534", "#047857", "#4d7c0f", "#0f766e", "#3f6212", "#15803d"]},
+];
+
+export const isMindmapColor = (value: unknown): value is string =>
+ typeof value === "string" && /^#[0-9a-f]{6}$/i.test(value);
+
+export const isListMindmapAppearance = (value: unknown): value is ListMindmapAppearance => {
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
+ return false;
+ }
+ const data = value as Record<string, unknown>;
+ return data.version === 1 && Array.isArray(data.palette) && data.palette.length <= 24 &&
+ data.palette.every(isMindmapColor) &&
+ (data.backgroundColor === undefined || data.backgroundColor === "" || isMindmapColor(data.backgroundColor));
+};
+
+// 只为新增的一级分支分配色位;已有色位随节点保存,重排、复制和切换色卡不会重置。
+export const assignListMindmapBranchColors = (model: ListMindmapModel) => {
+ if (!model.metadata.appearance?.palette.length) {
+ return false;
+ }
+ const used = new Set(model.root.children.map(node => model.metadata.nodes[node.id]?.branchColor)
+ .filter(value => value !== undefined));
+ let changed = false;
+ let slot = 0;
+ for (const node of model.root.children) {
+ if (model.metadata.nodes[node.id]?.branchColor !== undefined) {
+ continue;
+ }
+ while (used.has(slot)) {
+ slot++;
+ }
+ model.metadata.nodes[node.id] = {...model.metadata.nodes[node.id], branchColor: slot};
+ used.add(slot++);
+ changed = true;
+ }
+ return changed;
+};
+
+// 文字颜色按实际填充色的相对亮度选择,浅色与深色画布使用同一份文档配色。
+export const getMindmapTextColor = (color: string) => {
+ const values = [1, 3, 5].map(index => {
+ const value = parseInt(color.slice(index, index + 2), 16) / 255;
+ return value <= .04045 ? value / 12.92 : Math.pow((value + .055) / 1.055, 2.4);
+ });
+ return values[0] * .2126 + values[1] * .7152 + values[2] * .0722 > .179 ? "#000000" : "#ffffff";
+};
+
+export const resolveListMindmapColors = (model: ListMindmapModel) => {
+ const result = new Map<string, ListMindmapNodeStyle>();
+ const palette = model.metadata.appearance?.palette;
+ if (!palette?.length) {
+ return result;
+ }
+ const pending = [{node: model.root, color: palette[0]}];
+ while (pending.length) {
+ const {node, color} = pending.pop();
+ result.set(node.id, {backgroundColor: color, textColor: getMindmapTextColor(color), lineColor: color});
+ node.children.forEach((child, index) => pending.push({node: child, color: node === model.root ?
+ palette[(model.metadata.nodes[child.id]?.branchColor ?? index) % palette.length] : color}));
+ }
+ return result;
+};
+
+export const clearListMindmapManualColors = (metadata: ListMindmapMetadata) => {
+ Object.values(metadata.nodes).forEach(style => {
+ delete style.textColor;
+ delete style.backgroundColor;
+ delete style.lineColor;
+ });
+ metadata.relations.forEach(relation => delete relation.color);
+ metadata.summaries?.forEach(summary => delete summary.color);
+};
+
+export const getListMindmapAppearanceMenu = (metadata: ListMindmapMetadata,
+ change: (update: (data: ListMindmapMetadata) => void) => void,
+ labels: Record<string, string>, connector: IMenu): IMenu => {
+ const palette = metadata.appearance?.palette || [];
+ const background = metadata.appearance?.backgroundColor || "";
+ return {
+ id: "appearance", icon: "iconTheme", label: labels.appearance,
+ submenu: [
+ {id: "theme", iconHTML: "", label: labels.theme, submenu: [
+ {id: "default", iconHTML: "", label: labels.default, checked: !palette.length,
+ click: () => change(data => {
+ data.appearance = {...data.appearance, version: 1, palette: []};
+ })},
+ ...LIST_MINDMAP_PALETTES.map(preset => ({
+ id: preset.id, iconHTML: `<span class="color__square" style="background-color:${preset.colors[0]}"></span>`,
+ label: labels[preset.label],
+ checked: JSON.stringify(palette) === JSON.stringify(preset.colors),
+ click: () => change(data => {
+ data.appearance = {...data.appearance, version: 1, palette: [...preset.colors]};
+ }),
+ })),
+ ]},
+ {id: "canvasBackground", iconHTML: "", label: labels.listMindmapCanvasBackground, submenu: [
+ {id: "default", color: "", label: labels.default},
+ {id: "light", color: "#ffffff", label: labels.themeLight},
+ {id: "dark", color: "#1e1e1e", label: labels.themeDark},
+ ...LIST_MINDMAP_PALETTES[1].colors.map(color => ({id: color, color, label: color})),
+ ].map(item => ({id: item.id,
+ iconHTML: item.color ? `<span class="color__square" style="background-color:${item.color}"></span>` : "",
+ label: item.label, checked: background === item.color,
+ click: () => change(data => {
+ data.appearance = {...data.appearance, version: 1, palette: data.appearance?.palette || [],
+ backgroundColor: item.color};
+ })}))},
+ connector,
+ {id: "clearManualColors", iconHTML: "", label: labels.listMindmapClearManualColors,
+ click: () => change(clearListMindmapManualColors)},
+ ],
+ };
+};
diff --git a/app/src/protyle/render/listMindmap/arrows.test.ts b/app/src/protyle/render/listMindmap/arrows.test.ts
index 4634d2daaa..32d0a46d2b 100644
--- a/app/src/protyle/render/listMindmap/arrows.test.ts
+++ b/app/src/protyle/render/listMindmap/arrows.test.ts
@@ -104,6 +104,33 @@ test("shared orthogonal trunks keep the default color and stay outside branch se
}
});
+test("palette colors reach hierarchy paths and parent trunks while manual line colors remain authoritative", () => {
+ for (const connectorStyle of ["spline", "bezier", "orthogonal", "rounded"]) {
+ for (const printLayout of [false, true]) {
+ const {target, strokeStyles} = setup();
+ target.model.root.id = "root";
+ Object.assign(target.model.metadata, {connectorStyle, relations: [], nodes: {a: {lineColor: "#abcdef"}}});
+ target.themeColors = new Map([
+ ["root", {lineColor: "#111111"}], ["a", {lineColor: "#222222"}],
+ ["b", {lineColor: "#333333"}], ["c", {lineColor: "#333333"}],
+ ]);
+ target.options.printLayout = printLayout;
+ target.readOnly = printLayout;
+ target.positions = new Map([
+ ["root", {id: "root", x: 20, y: 100, width: 100, height: 40}],
+ ["a", {id: "a", x: 160, y: 0, width: 100, height: 40}],
+ ["b", {id: "b", x: 160, y: 200, width: 100, height: 40}],
+ ["c", {id: "c", x: 300, y: 200, width: 100, height: 40}],
+ ]);
+ target.edges = [{from: "root", to: "a"}, {from: "root", to: "b"}, {from: "b", to: "c"}];
+ target.draw();
+ const trunks = connectorStyle === "orthogonal" || connectorStyle === "rounded" ? ["#111111", "#333333"] : [];
+ assert.deepEqual(strokeStyles, [...trunks, "#abcdef", "#333333", "#333333"]);
+ assert.equal(target.linePaths.length, 3, "shared trunks never become selectable branch paths");
+ }
+ }
+});
+
test("all arrow modes use endpoint identity rather than canonical path drawing order", () => {
for (const mode of [undefined, "forward", "reverse", "both", "none"] as const) {
for (const scale of [.5, 1, 2]) {
diff --git a/app/src/protyle/render/listMindmap/clipboard.test.ts b/app/src/protyle/render/listMindmap/clipboard.test.ts
index 160e30f44d..6c3fc207d1 100644
--- a/app/src/protyle/render/listMindmap/clipboard.test.ts
+++ b/app/src/protyle/render/listMindmap/clipboard.test.ts
@@ -19,7 +19,7 @@ const browserCases = async (source: string, css: string) => {
"genListItemElement", "disposeCustomBlocksInElement", "processRender", "highlightRender", "avRender", "blockRender",
source + "; return {readListMindmap, retagMindmapBranch, writeListMindmapMetadata, copyMindmapBranches, " +
"readMindmapClipboard, pasteMindmapBranches, canCutMindmapBranches, removeMindmapBranches, " +
- "ListMindmapView, ClipboardController};")(
+ "ListMindmapView, ClipboardController, assignListMindmapBranchColors, resolveListMindmapColors};")(
constants, async () => {}, (owner: {disabled?: boolean}) => !owner.disabled,
(message: string) => messages.push(message), () => write(), () => read(),
(html: string) => html, (html: string) => html, (): null => null, (): void => {}, (): void => {},
@@ -52,6 +52,8 @@ const browserCases = async (source: string, css: string) => {
const model = api.readListMindmap(list);
const [a, b, c] = model.root.children;
model.metadata.nodes[a.id] = {backgroundColor: "red"};
+ model.metadata.appearance = {version: 1, palette: ["#2563eb", "#15803d"], backgroundColor: "#1e1e1e"};
+ api.assignListMindmapBranchColors(model);
model.metadata.relations = [
{id: Lute.NewNodeID(), from: a.id, to: b.id, label: "Inside"},
{id: Lute.NewNodeID(), from: a.id, to: c.id, label: "Outside"},
@@ -64,13 +66,18 @@ const browserCases = async (source: string, css: string) => {
check.equal(list.outerHTML, before);
const payload = api.readMindmapClipboard(copied);
const selected = api.readListMindmap(payload);
+ check.deepEqual(selected.metadata.appearance, model.metadata.appearance);
check.deepEqual(selected.root.children.map((node: {id: string}) => node.id), [a.id, b.id],
"copy follows source order and excludes duplicate descendants");
check.equal(selected.nodes.size, 4);
check.equal(selected.metadata.relations.length, 1);
check.equal(selected.metadata.summaries[0].parentId, payload.dataset.nodeId);
for (const placement of ["child", "after"]) {
- const pasted = api.pasteMindmapBranches(list, payload, c.id, placement, lute);
+ const destination = list.cloneNode(true) as HTMLElement;
+ const destinationModel = api.readListMindmap(destination);
+ destinationModel.metadata.appearance = {version: 1, palette: ["#166534", "#047857"], backgroundColor: "#ffffff"};
+ api.writeListMindmapMetadata(destination, destinationModel.metadata);
+ const pasted = api.pasteMindmapBranches(destination, payload, c.id, placement, lute);
check.ok(pasted);
const next = api.readListMindmap(pasted.list);
const oldIDs = new Set([list.dataset.nodeId, ...Array.from(list.querySelectorAll<HTMLElement>("[data-node-id]"))
@@ -81,6 +88,10 @@ const browserCases = async (source: string, css: string) => {
check.equal(next.nodes.get(pasted.ids[0]).children.length, 1);
check.match(next.nodes.get(pasted.ids[0]).element.outerHTML, /bold/);
check.equal(next.metadata.nodes[pasted.ids[0]].backgroundColor, "red");
+ check.equal(next.metadata.nodes[pasted.ids[0]].branchColor, model.metadata.nodes[a.id].branchColor,
+ "copied branch color slots follow remapped node IDs");
+ check.deepEqual(next.metadata.appearance, destinationModel.metadata.appearance,
+ "pasting branches retains the destination appearance");
check.equal(next.metadata.relations.length, 3);
const relation = next.metadata.relations[2];
check.deepEqual([relation.from, relation.to], pasted.ids);
@@ -120,6 +131,11 @@ const browserCases = async (source: string, css: string) => {
document.body.append(list);
const model = api.readListMindmap(list);
const [a, b] = model.root.children;
+ model.metadata.appearance = {version: 1, palette: ["#2563eb", "#15803d"], backgroundColor: "#1e1e1e"};
+ api.assignListMindmapBranchColors(model);
+ model.metadata.nodes[a.id].backgroundColor = "red";
+ model.metadata.nodes[a.id].textColor = "white";
+ api.writeListMindmapMetadata(list, model.metadata);
const host = document.createElement("div");
host.className = "mindmap-view";
host.style.cssText = "position:relative;width:850px;height:500px";
@@ -127,6 +143,7 @@ const browserCases = async (source: string, css: string) => {
const copied: {ids: string[], cut: boolean}[] = [];
const pasted: {id: string, kind: string}[] = [];
const menus: {anchor: HTMLElement, ids: string[]}[] = [];
+ const styleChanges: {ids: string[], patch: Record<string, string>}[] = [];
// Synthetic events have no native pointer capture; geometry and handlers still run in Chromium.
const capture = HTMLElement.prototype.setPointerCapture;
const hasCapture = HTMLElement.prototype.hasPointerCapture;
@@ -135,9 +152,22 @@ const browserCases = async (source: string, css: string) => {
const view = new api.ListMindmapView({host, model, onExit() {},
onCopy: (ids: string[], cut: boolean) => copied.push({ids, cut}),
onPaste: (id: string, kind: string) => pasted.push({id, kind}),
- onClipboardMenu: (anchor: HTMLElement, ids: string[]) => menus.push({anchor, ids}), onDeleteNodes() {}});
+ onClipboardMenu: (anchor: HTMLElement, ids: string[]) => menus.push({anchor, ids}), onDeleteNodes() {},
+ nodeColors: () => [{label: "Batch orange", color: "#000000", backgroundColor: "#fed7aa"}],
+ colors: () => [{label: "Branch green", value: "#15803d"}],
+ onNodesStyle: (ids: string[], patch: Record<string, string>) => {
+ styleChanges.push({ids, patch});
+ ids.forEach(id => model.metadata.nodes[id] = {...model.metadata.nodes[id], ...patch});
+ api.writeListMindmapMetadata(list, model.metadata);
+ view.update(model);
+ }});
const wait = () => new Promise(resolve => setTimeout(resolve, 40));
await wait();
+ check.equal(view.viewport.style.backgroundColor, "rgb(30, 30, 30)");
+ check.equal(view.nodeElements.get(a.id).style.backgroundColor, "red", "manual colors survive applying a theme");
+ check.equal(view.nodeElements.get(b.id).style.backgroundColor, "rgb(21, 128, 61)");
+ check.equal(view.nodeElements.get(a.children[0].id).style.backgroundColor, "rgb(37, 99, 235)",
+ "descendants follow their branch theme independently of a parent's manual override");
const pointer = (id: string, modifiers: PointerEventInit = {}) => {
const node = view.nodeElements.get(id) as HTMLElement;
const rect = node.getBoundingClientRect();
@@ -169,6 +199,34 @@ const browserCases = async (source: string, css: string) => {
pointer(b.id, {ctrlKey: true});
await checkNodeMenu();
check.deepEqual(new Set(view.getSelectedIds()), new Set([a.id, b.id]));
+ host.querySelector<HTMLButtonElement>('[aria-label="Batch orange"]').click();
+ check.equal(styleChanges.length, 1, "batch colors use one callback for the complete selection");
+ check.deepEqual(new Set(styleChanges[0].ids), new Set([a.id, b.id]));
+ check.equal(view.nodeElements.get(a.id).style.backgroundColor, "rgb(254, 215, 170)");
+ check.equal(view.nodeElements.get(b.id).style.backgroundColor, "rgb(254, 215, 170)");
+ host.querySelector<HTMLButtonElement>('[aria-label="Branch green"]').click();
+ check.equal(styleChanges.length, 2);
+ check.equal(model.metadata.nodes[a.id].lineColor, "#15803d");
+ check.equal(model.metadata.nodes[b.id].lineColor, "#15803d");
+ const nodePalette = host.querySelector<HTMLElement>('.mindmap-view__palette[aria-label="color"]');
+ nodePalette.querySelector<HTMLButtonElement>('[aria-label="default"]').click();
+ check.equal(view.nodeElements.get(a.id).style.backgroundColor, "rgb(37, 99, 235)",
+ "resetting manual node colors restores the branch theme");
+ const persisted = api.readMindmapClipboard(lute.SpinBlockDOM(list.outerHTML));
+ for (const printLayout of [false, true]) {
+ const previewHost = document.createElement("div");
+ previewHost.className = "mindmap-view";
+ previewHost.style.cssText = "width:760px;height:460px";
+ document.body.append(previewHost);
+ const preview = new api.ListMindmapView({host: previewHost, model: api.readListMindmap(persisted),
+ readOnly: true, printLayout, onExit() {}});
+ await wait();
+ check.equal(preview.viewport.style.backgroundColor, "rgb(30, 30, 30)");
+ check.equal(preview.nodeElements.get(a.id).style.backgroundColor, "rgb(37, 99, 235)",
+ "read-only HTML and PDF layout render the saved palette");
+ preview.destroy();
+ previewHost.remove();
+ }
check.equal(host.querySelectorAll('[aria-selected="true"]').length, 2);
host.dispatchEvent(new ClipboardEvent("copy", {bubbles: true, cancelable: true, clipboardData: new DataTransfer()}));
check.deepEqual(new Set(copied[0].ids), new Set([a.id, b.id]));
@@ -311,7 +369,7 @@ test("mind map selection and clipboard preserve branches, metadata, identities a
const methods = controller.members.filter(member =>
["copyNodes", "removeNodes", "replaceClipboardSource", "replaceSourceChildren", "pasteNodes", "add"]
.includes(member.name?.getText(sourceFile)));
- const source = ["../../wysiwyg/listContext.ts", "summary.ts", "model.ts", "../../util/tabsCopy.ts", "clipboard.ts",
+ const source = ["../../wysiwyg/listContext.ts", "summary.ts", "appearance.ts", "model.ts", "../../util/tabsCopy.ts", "clipboard.ts",
"fold.ts", "routing.ts", "pan.ts", "connectors.ts", "../av/richTextValue.ts", "view.ts",
"../../util/blockDOMClipboard.ts", "../../util/clipboardData.ts"].map(compile).join("\n") +
ts.transpileModule(`class ClipboardController {${methods.map(method => method.getText(sourceFile)).join("\n")}}`,
diff --git a/app/src/protyle/render/listMindmap/connectorMenu.test.ts b/app/src/protyle/render/listMindmap/connectorMenu.test.ts
index c7c6e284df..93c7092e69 100644
--- a/app/src/protyle/render/listMindmap/connectorMenu.test.ts
+++ b/app/src/protyle/render/listMindmap/connectorMenu.test.ts
@@ -5,24 +5,31 @@ import {runInNewContext} from "node:vm";
import {createSourceFile, isClassDeclaration, isPropertyAssignment, ScriptTarget, transpileModule} from "typescript";
import {getListMindmapConnectorMenuItem} from "./connectorMenu";
import {getListMindmapFoldMenuItems} from "./foldMenu";
+import {assignListMindmapBranchColors, getListMindmapAppearanceMenu} from "./appearance";
const source = createSourceFile("index.ts", readFileSync("src/protyle/render/listMindmap/index.ts", "utf8"),
ScriptTarget.ES2021, true);
const controller = source.statements.find(item => isClassDeclaration(item) && item.name?.text === "ListMindmapController");
assert.ok(controller && isClassDeclaration(controller));
let callback = "";
+let batchCallback = "";
const visit = (node: import("typescript").Node) => {
if (isPropertyAssignment(node) && node.name.getText(source) === "onSettingsMenu") {
callback = node.initializer.getText(source);
}
+ if (isPropertyAssignment(node) && node.name.getText(source) === "onNodesStyle") {
+ batchCallback = node.initializer.getText(source);
+ }
node.forEachChild(visit);
};
visit(controller);
assert.ok(callback);
+assert.ok(batchCallback);
const methods = controller.members.filter(item => item.name && ["metadata", "change"].includes(item.name.getText(source)));
const compiled = transpileModule(`class Controller {
${methods.map(item => item.getText(source)).join("\n")}
onSettingsMenu = ${callback};
+ onNodesStyle = ${batchCallback};
}
globalThis.Controller = Controller;`, {compilerOptions: {target: ScriptTarget.ES2021}}).outputText;
@@ -35,6 +42,7 @@ test("desktop and mobile connector menus persist one undoable change and preserv
const transactions: {before: string, after: string}[] = [];
let editable = true;
let item: IMenu;
+ let appearanceItem: IMenu;
let defaultItem: IMenu;
let expandItem: IMenu;
let panItem: IMenu;
@@ -47,13 +55,15 @@ test("desktop and mobile connector menus persist one undoable change and preserv
owner: {}, list,
canEdit: () => editable,
getListMindmapConnectorMenuItem,
+ getListMindmapAppearanceMenu,
+ assignListMindmapBranchColors,
getListMindmapFoldMenuItems,
getDefaultListMindmapConnectorStyle: () => defaultStyle,
setDefaultListMindmapConnectorStyle: (style: string) => { defaultStyle = style; defaults.push(style); },
getListMindmapSiblingIDs: () => new Map(),
normalizeListMindmapSummaryMetadata: () => {},
- readListMindmap: () => ({root: {id: "root"}, metadata: JSON.parse(JSON.stringify(data)),
- nodes: new Map([["root", {children: []}]])}),
+ readListMindmap: () => ({root: {id: "root", children: [{id: "child"}]}, metadata: JSON.parse(JSON.stringify(data)),
+ nodes: new Map([["root", {children: []}], ["child", {children: []}]])}),
writeListMindmapMetadata: (_list: unknown, value: typeof data) => data = value,
cleanListMindmapHTML: (html: string) => html,
updateTransaction: (_owner: unknown, _list: unknown, before: string) =>
@@ -71,7 +81,10 @@ test("desktop and mobile connector menus persist one undoable change and preserv
if (value.id === "defaultConnectorStyle") { defaultItem = value; }
else if (value.id === "expandLevel") { expandItem = value; }
else if (value.id === "pan") { panItem = value; }
- else { item = value; }
+ else if (value.id === "appearance") {
+ appearanceItem = value;
+ item = (value.submenu as IMenu[]).find(entry => entry.id === "connectorStyle");
+ }
}
open(position: unknown) { placements.push(position); }
fullscreen(position: unknown) { placements.push(position); }
@@ -122,9 +135,31 @@ test("desktop and mobile connector menus persist one undoable change and preserv
target.activeEditor = undefined;
choose("bezier");
assert.equal(Object.hasOwn(data, "connectorStyle"), false, "restoring the default removes the optional field");
+ target.onSettingsMenu(anchor);
+ const theme = (appearanceItem.submenu as IMenu[]).find(entry => entry.id === "theme");
+ const beforeTheme = list.outerHTML;
+ const beforeCount = transactions.length;
+ (theme.submenu as IMenu[]).find(entry => entry.id === "colorful").click(undefined, undefined);
+ assert.equal(transactions.length, beforeCount + 1, "applying a palette is one document transaction on both platforms");
+ assert.equal(transactions.at(-1).before, beforeTheme);
+ assert.equal(JSON.parse(list.outerHTML).nodes.child.lineColor, "red", "theme changes retain manual overrides");
+ assert.equal(JSON.parse(list.outerHTML).nodes.child.branchColor, 0, "branch slots are saved with the same snapshot");
+ const themed = list.outerHTML;
+ data = JSON.parse(beforeTheme);
+ assert.equal(JSON.parse(list.outerHTML).appearance, undefined, "undo restores the unthemed document");
+ data = JSON.parse(themed);
+ target.onNodesStyle(["root", "child", "deleted"], {backgroundColor: "#fed7aa", textColor: "#000000"});
+ assert.equal(transactions.length, beforeCount + 2, "batch node colors save one snapshot");
+ const updated = JSON.parse(list.outerHTML);
+ assert.equal(updated.nodes.root.backgroundColor, "#fed7aa");
+ assert.equal(updated.nodes.child.backgroundColor, "#fed7aa");
+ assert.equal(updated.nodes.child.lineColor, "red");
+ assert.equal(updated.nodes.deleted, undefined, "a stale selection cannot create orphan styles");
const count = transactions.length;
editable = false;
choose("spline");
+ (theme.submenu as IMenu[]).find(entry => entry.id === "forest").click(undefined, undefined);
+ target.onNodesStyle(["root", "child"], {backgroundColor: "#ffffff"});
(defaultItem.submenu as IMenu[]).find(entry => entry.id === "spline").click(undefined, undefined);
assert.deepEqual(defaults, ["rounded"], "a stale menu cannot change preferences after editing is disabled");
assert.equal(transactions.length, count, "an already open menu cannot edit a newly read-only map");
diff --git a/app/src/protyle/render/listMindmap/connectors.ts b/app/src/protyle/render/listMindmap/connectors.ts
index 120fd998ca..28b2319a34 100644
--- a/app/src/protyle/render/listMindmap/connectors.ts
+++ b/app/src/protyle/render/listMindmap/connectors.ts
@@ -45,6 +45,7 @@ export const buildListMindmapConnectors = <T extends ConnectorPath>(
style: ListMindmapConnectorStyle, makePath: () => T,
) => {
const trunks: T[] = [];
+ const trunkParents: string[] = [];
const branches: {id: string, path: T}[] = [];
const groups = new Map<string, ListMindmapPosition[]>();
edges.forEach(edge => {
@@ -101,6 +102,7 @@ export const buildListMindmapConnectors = <T extends ConnectorPath>(
trunk.lineTo(trunkX, bottom);
}
trunks.push(trunk);
+ trunkParents.push(parentID);
});
- return {trunks, branches};
+ return {trunks, trunkParents, branches};
};
diff --git a/app/src/protyle/render/listMindmap/focus.test.ts b/app/src/protyle/render/listMindmap/focus.test.ts
index d343aed16a..39ad5f99a5 100644
--- a/app/src/protyle/render/listMindmap/focus.test.ts
+++ b/app/src/protyle/render/listMindmap/focus.test.ts
@@ -118,7 +118,8 @@ test("text history records the edited node even when selection changes before it
const list = {isConnected: true, dataset: {nodeId: "map"}, outerHTML: "before", closest: (): null => null};
const operations: {undo: Record<string, string>, redo: Record<string, string>}[] = [];
const context: any = {
- canEdit: () => true, readListMindmap: () => ({nodes, root: nodes.get("root")}),
+ canEdit: () => true, readListMindmap: () => ({nodes, root: nodes.get("root"),
+ metadata: {version: 1, nodes: {}, relations: [] as unknown[]}}),
cleanListMindmapHTML: (html: string) => html, getListMindmapSiblingIDs: () => new Map(),
normalizeListMindmapSummaryMetadata: () => {},
updateTransaction: (_owner: unknown, _list: unknown, _before: string, undo: Record<string, string>,
@@ -156,7 +157,7 @@ test("mind map transaction focus survives insertion, deletion and repeated undo/
return child;
});
});
- return {nodes, root: nodes.get("root")};
+ return {nodes, root: nodes.get("root"), metadata: {version: 1, nodes: {}, relations: [] as unknown[]}};
};
const list = {isConnected: true, dataset: {nodeId: "map"}, closest: (): null => null,
get outerHTML() { return JSON.stringify(state); }};
diff --git a/app/src/protyle/render/listMindmap/fold.test.ts b/app/src/protyle/render/listMindmap/fold.test.ts
index ae49e9f9c4..073070a008 100644
--- a/app/src/protyle/render/listMindmap/fold.test.ts
+++ b/app/src/protyle/render/listMindmap/fold.test.ts
@@ -149,7 +149,7 @@ test("batch folding saves a single undo snapshot and reads the source after fini
let allowed = true;
const context: any = {
canEdit: () => allowed,
- readListMindmap: () => ({root, nodes}),
+ readListMindmap: () => ({root, nodes, metadata: {version: 1, nodes: {}, relations: [] as unknown[]}}),
getListMindmapSiblingIDs: () => new Map(),
normalizeListMindmapSummaryMetadata: () => {},
getListMindmapFoldStates,
diff --git a/app/src/protyle/render/listMindmap/fullscreen.test.ts b/app/src/protyle/render/listMindmap/fullscreen.test.ts
index 718359c9a9..c66c23ff0f 100644
--- a/app/src/protyle/render/listMindmap/fullscreen.test.ts
+++ b/app/src/protyle/render/listMindmap/fullscreen.test.ts
@@ -189,7 +189,7 @@ test("fullscreen preserves entry focus and restores the document viewport withou
skip: process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY,
timeout: 30000,
}, async () => {
- const source = ["../av/richTextValue.ts", "summary.ts", "connectors.ts", "model.ts", "fold.ts", "routing.ts", "pan.ts", "view.ts"]
+ const source = ["../av/richTextValue.ts", "summary.ts", "connectors.ts", "appearance.ts", "model.ts", "fold.ts", "routing.ts", "pan.ts", "view.ts"]
.map(file => transpileModule(readFileSync(path.join(__dirname, file), "utf8")
.replace(/^import [\s\S]*?;\r?\n/gm, "").replace(/^export /gm, ""), {
compilerOptions: {target: ScriptTarget.ES2021},
diff --git a/app/src/protyle/render/listMindmap/index.ts b/app/src/protyle/render/listMindmap/index.ts
index e9b8bba935..bd63ef203a 100644
--- a/app/src/protyle/render/listMindmap/index.ts
+++ b/app/src/protyle/render/listMindmap/index.ts
@@ -57,6 +57,7 @@ import {avRender} from "../av/render";
import {blockRender} from "../blockRender";
import {getListMindmapConnectorMenuItem} from "./connectorMenu";
import {getDefaultListMindmapConnectorStyle, setDefaultListMindmapConnectorStyle} from "./preferences";
+import {assignListMindmapBranchColors, getListMindmapAppearanceMenu} from "./appearance";
import {getEmbedChildOperationContext} from "../../wysiwyg/getBlock";
import {requestRedo, requestUndo} from "../../undo/globalUndo";
import {buildBlockDOMClipboardData} from "../../util/blockDOMClipboard";
@@ -261,7 +262,10 @@ class ListMindmapController {
});
}
if (canEdit(owner, list)) {
- menu.addItem(getListMindmapConnectorMenuItem(readListMindmap(list).metadata.connectorStyle || "bezier",
+ const current = readListMindmap(list).metadata;
+ menu.addItem(getListMindmapAppearanceMenu(current,
+ update => void this.metadata(update), window.siyuan.languages,
+ getListMindmapConnectorMenuItem(current.connectorStyle || "bezier",
style => {
void this.metadata(metadata => {
if ((metadata.connectorStyle || "bezier") === style) {
@@ -273,7 +277,7 @@ class ListMindmapController {
metadata.connectorStyle = style;
}
});
- }, window.siyuan.languages));
+ }, window.siyuan.languages)));
menu.addItem(getListMindmapConnectorMenuItem(getDefaultListMindmapConnectorStyle(), style => {
if (canEdit(owner, list)) {
setDefaultListMindmapConnectorStyle(style);
@@ -477,6 +481,12 @@ class ListMindmapController {
onNodeStyle: (id, patch) => this.metadata(metadata => {
metadata.nodes[id] = {...metadata.nodes[id], ...patch};
}),
+ onNodesStyle: (ids, patch) => this.metadata(metadata => {
+ const nodes = readListMindmap(list).nodes;
+ ids.filter(id => nodes.has(id)).forEach(id => {
+ metadata.nodes[id] = {...metadata.nodes[id], ...patch};
+ });
+ }),
onRelationAdd: (from, to) => this.metadata(metadata => {
if (from !== to && !metadata.relations.some(relation => relation.from === from && relation.to === to)) {
metadata.relations.push({id: Lute.NewNodeID(), from, to, label: ""});
@@ -688,8 +698,11 @@ class ListMindmapController {
return false;
}
normalizeListMindmapSummaryMetadata(this.list, previous);
+ const next = readListMindmap(this.list);
+ if (next.metadata.appearance?.palette.length && assignListMindmapBranchColors(next)) {
+ writeListMindmapMetadata(this.list, next.metadata);
+ }
if (cleanListMindmapHTML(this.list.outerHTML) !== before) {
- const next = readListMindmap(this.list);
const nextID = [focusID, selectedID, siblings[index + 1]?.id, siblings[index - 1]?.id,
selected?.parentId].find(id => next.nodes.has(id)) || next.root.id;
// 将操作前后的节点分别记录在事务中,重做时可定位到重新插入的节点。
diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.ts
index 4a1bd32eb7..a9605192bd 100644
--- a/app/src/protyle/render/listMindmap/model.test.ts
+++ b/app/src/protyle/render/listMindmap/model.test.ts
@@ -168,6 +168,24 @@ test("connector presets extend both metadata versions without migrating legacy c
}
});
+test("appearance metadata is additive and rejects invalid palettes and branch slots without changing source", () => {
+ for (const version of [1, 2]) {
+ const base = {version, nodes: {a: {branchColor: 2, lineColor: "red"}}, relations: [] as unknown[], extension: "keep"};
+ const appearance = {version: 1, palette: ["#123456", "#abcdef"], backgroundColor: "#ffffff", extension: "keep"};
+ const source = JSON.stringify({...base, appearance});
+ assert.equal(JSON.stringify(parseListMindmapMetadata(source)), source);
+ for (const invalid of [null, [], {}, {...appearance, version: 2}, {...appearance, palette: ["red"]},
+ {...appearance, backgroundColor: "url(x)"}]) {
+ const value = JSON.stringify({...base, appearance: invalid});
+ assert.throws(() => parseListMindmapMetadata(value), /Invalid list mindmap metadata/);
+ }
+ for (const branchColor of [-1, .5, null, "1", 9007199254740992]) {
+ const value = JSON.stringify({...base, nodes: {a: {branchColor}}, appearance});
+ assert.throws(() => parseListMindmapMetadata(value), /Invalid list mindmap metadata/);
+ }
+ }
+});
+
test("manual relation routes are optional, versioned and validated without dropping extension fields", () => {
const route = {version: 1, points: [{x: -40, y: 25.5, t: .4, extension: "keep"}], extension: "keep"};
const metadata = {version: 1, nodes: {}, relations: [{id: "r", from: "a", to: "b", label: "", route}]};
@@ -5082,7 +5100,8 @@ test("list mindmap mutations preserve block data in the real DOM and Lute", {
const source = tabsSource + compile(path.join(__dirname, "../../wysiwyg/tabsList.ts")) +
compile(path.join(__dirname, "../av/richTextValue.ts")) + compile(path.join(__dirname, "../../wysiwyg/listContext.ts")) +
compile(path.join(__dirname, "summary.ts")) + compile(path.join(__dirname, "connectors.ts")) +
- compile(path.join(__dirname, "model.ts")) + compile(path.join(__dirname, "preferences.ts")) + compile(path.join(__dirname, "fold.ts")) +
+ compile(path.join(__dirname, "appearance.ts")) + compile(path.join(__dirname, "model.ts")) +
+ compile(path.join(__dirname, "preferences.ts")) + compile(path.join(__dirname, "fold.ts")) +
compile(path.join(__dirname, "routing.ts")) + compile(path.join(__dirname, "pan.ts")) +
compile(path.join(__dirname, "view.ts")) +
compile(path.join(__dirname, "legacy.ts")) + compile(path.join(__dirname, "migrate.ts")) +
diff --git a/app/src/protyle/render/listMindmap/model.ts b/app/src/protyle/render/listMindmap/model.ts
index ef46804981..0a6b61f538 100644
--- a/app/src/protyle/render/listMindmap/model.ts
+++ b/app/src/protyle/render/listMindmap/model.ts
@@ -5,8 +5,11 @@ import {getListMindmapSiblingIDs, isListMindmapSummaryCrossing, normalizeListMin
import type {ListMindmapSummary} from "./summary";
import {LIST_MINDMAP_CONNECTOR_STYLES} from "./connectors";
import type {ListMindmapConnectorStyle} from "./connectors";
+import {isListMindmapAppearance} from "./appearance";
+import type {ListMindmapAppearance} from "./appearance";
export interface ListMindmapNodeStyle {
+ branchColor?: number;
textColor?: string;
backgroundColor?: string;
borderColor?: string;
@@ -39,6 +42,7 @@ export interface ListMindmapMetadata {
rootTitle?: string;
viewLocked?: boolean;
connectorStyle?: ListMindmapConnectorStyle;
+ appearance?: ListMindmapAppearance;
nodes: Record<string, ListMindmapNodeStyle>;
relations: ListMindmapRelation[];
summaries?: ListMindmapSummary[];
@@ -112,9 +116,13 @@ export const parseListMindmapMetadata = (value: string | null): ListMindmapMetad
throw invalidMetadata();
}
const numberKeys = ["fontSize", "borderWidth", "borderRadius", "lineWidth"];
+ if ("appearance" in data && !isListMindmapAppearance(data.appearance)) {
+ throw invalidMetadata();
+ }
const booleanKeys = ["bold", "italic", "lineDash"];
for (const [id, style] of Object.entries(data.nodes)) {
if (!id || !isRecord(style) ||
+ ("branchColor" in style && (!Number.isSafeInteger(style.branchColor) || Number(style.branchColor) < 0)) ||
stringKeys.some(key => key in style && typeof style[key] !== "string") ||
numberKeys.some(key => key in style && (typeof style[key] !== "number" ||
!Number.isFinite(style[key]) || Number(style[key]) < 0)) ||
diff --git a/app/src/protyle/render/listMindmap/preview.test.ts b/app/src/protyle/render/listMindmap/preview.test.ts
index bab43bc62a..3813e4f51c 100644
--- a/app/src/protyle/render/listMindmap/preview.test.ts
+++ b/app/src/protyle/render/listMindmap/preview.test.ts
@@ -183,7 +183,8 @@ const cases = async (source: string, css: string) => {
const node = {id: "table-node", children: [] as unknown[], contentBlocks: [richTable], virtual: false};
const model = {root: node, nodes: new Map([[node.id, node]]), metadata: {nodes: {}, relations: [] as {id: string}[]}};
const view = Object.assign(new api.MindmapPreviewView(), {
- options: {}, persistedLocked: false, nodeElements: new Map([[node.id, nodeElement]]), folded: new Map(), selectedIds: new Set(),
+ options: {}, viewport: document.createElement("div"), persistedLocked: false,
+ nodeElements: new Map([[node.id, nodeElement]]), folded: new Map(), selectedIds: new Set(),
cancelSummarySelection: () => {}, renderTask: () => {}, destroyContentViews: () => {},
label: (key: string) => key, updateRelations: () => {}, updateSummaries: () => {},
updateSelection: () => {}, renderInspector: () => {}, refreshLayout: () => {},
@@ -260,6 +261,8 @@ test("special block previews cannot acquire document writes or lose unsupported
extract("../../util/tableVirtualizationDOM.ts", ["TABLE_VIRTUAL_ID", "TABLE_VIRTUAL_ROWS"]) +
extract("../../util/tableControl.ts", ["getCell", "getTableNode"]) +
compile(`class TablePreviewControl {${methods.map(method => method.getText(tableSource)).join("\n")}}`) +
+ compile(readFileSync(path.join(__dirname, "appearance.ts"), "utf8")
+ .replace(/^import [\s\S]*?;\r?\n/gm, "").replace(/^export /gm, "")) +
compile(`class MindmapPreviewView {${viewMethods.map(method => method.getText(viewSource)).join("\n")}}`) +
extract("../av/richText.ts", ["ALLOWED_BLOCK_TYPES", "isSupportedAVRichTextBlock", "getAVRichTextUnsupportedPasteBlocks"]) +
extract("../av/richTextValue.ts", ["EXECUTABLE_CODE_LANGUAGES", "isAVRichTextExecutableCodeLanguage"]);
diff --git a/app/src/protyle/render/listMindmap/resizeTransaction.test.ts b/app/src/protyle/render/listMindmap/resizeTransaction.test.ts
index eb85d23dc6..e4b93da467 100644
--- a/app/src/protyle/render/listMindmap/resizeTransaction.test.ts
+++ b/app/src/protyle/render/listMindmap/resizeTransaction.test.ts
@@ -33,7 +33,8 @@ test("resizing uses one source update with both dimensions and retains the exact
const transactions: {before: string, after: string}[] = [];
const root = {id: "root", children: [] as unknown[]};
const context: any = {
- canEdit: () => true, readListMindmap: () => ({root, nodes: new Map([["root", root]])}),
+ canEdit: () => true, readListMindmap: () => ({root, nodes: new Map([["root", root]]),
+ metadata: {version: 1, nodes: {}, relations: [] as unknown[]}}),
getListMindmapSiblingIDs: () => new Map(), normalizeListMindmapSummaryMetadata: () => {},
cleanListMindmapHTML: (html: string) => html,
setBlockHeight: (block: typeof list, height: string) => block.style.height = height,
diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.ts
index 042a79c5aa..1f5c81afa8 100644
--- a/app/src/protyle/render/listMindmap/view.ts
+++ b/app/src/protyle/render/listMindmap/view.ts
@@ -22,6 +22,7 @@ import {getListMindmapSummaryParentID, getListMindmapSummaryRange, getListMindma
layoutListMindmapSummaries} from "./summary";
import type {ListMindmapSummary, ListMindmapSummaryPosition, ListMindmapSummaryRange} from "./summary";
import {buildListMindmapConnectors, buildListMindmapSummaryConnector} from "./connectors";
+import {getMindmapTextColor, isMindmapColor, resolveListMindmapColors} from "./appearance";
export interface ListMindmapViewOptions {
host: HTMLElement;
@@ -69,6 +70,7 @@ export interface ListMindmapViewOptions {
onUndo?: () => void;
onRedo?: () => void;
onNodeStyle?: (id: string, patch: Partial<ListMindmapNodeStyle>) => void;
+ onNodesStyle?: (ids: string[], patch: Partial<ListMindmapNodeStyle>) => void;
onRelationAdd?: (from: string, to: string) => void;
onRelationChange?: (id: string, patch: Partial<ListMindmapRelation>, expected?: string) => void;
onRelationDelete?: (id: string) => void;
@@ -120,6 +122,7 @@ const createElement = <T extends keyof HTMLElementTagNameMap>(tag: T, className:
};
export class ListMindmapView {
+ private themeColors = new Map<string, ListMindmapNodeStyle>();
private suppressPanContextMenu = false;
private readonly options: ListMindmapViewOptions;
private model: ListMindmapModel;
@@ -731,6 +734,8 @@ export class ListMindmapView {
return;
}
this.model = model;
+ this.themeColors = resolveListMindmapColors(model);
+ this.viewport.style.backgroundColor = model.metadata.appearance?.backgroundColor || "";
this.selectedIds.forEach(id => {
if (!model.nodes.has(id)) {
this.selectedIds.delete(id);
@@ -809,8 +814,11 @@ export class ListMindmapView {
element.classList.toggle("mindmap-view__node--root", id === model.root.id);
this.renderTask(element, id);
element.classList.toggle("mindmap-view__node--branch", node.children.length > 0);
- element.style.backgroundColor = model.metadata.nodes[id]?.backgroundColor || "";
- element.style.color = model.metadata.nodes[id]?.textColor || "";
+ const style = model.metadata.nodes[id];
+ const background = style?.backgroundColor || this.themeColors.get(id)?.backgroundColor || "";
+ element.style.backgroundColor = background;
+ element.style.color = style?.textColor || (this.themeColors.has(id) && isMindmapColor(background) ?
+ getMindmapTextColor(background) : this.themeColors.get(id)?.textColor) || "";
const collapsed = this.folded.get(id) ?? node.collapsed;
element.setAttribute("aria-expanded", String(!collapsed));
const fold = element.querySelector<HTMLButtonElement>(".mindmap-view__fold");
@@ -1923,18 +1931,24 @@ export class ListMindmapView {
const connectors = buildListMindmapConnectors(this.model.root.id, this.positions, this.edges,
this.model.metadata.connectorStyle || "bezier", () => new Path2D());
const rootStyle = this.model.metadata.nodes[this.model.root.id] || {};
- const trunkStyle = resolveLineStyle(lineStyles, rootStyle.lineColor, rootStyle.lineWidth, defaultLine, false, false);
- context.strokeStyle = trunkStyle.color;
- context.lineWidth = trunkStyle.width;
- context.setLineDash(rootStyle.lineDash ? [6, 4] : []);
- connectors.trunks.forEach(path => context.stroke(path));
+ connectors.trunks.forEach((path, index) => {
+ const id = connectors.trunkParents[index];
+ const style = this.themeColors?.size ? {...rootStyle, ...this.model.metadata.nodes[id]} : rootStyle;
+ const trunkStyle = resolveLineStyle(lineStyles, style.lineColor || this.themeColors?.get(id)?.lineColor,
+ style.lineWidth, defaultLine, false, false);
+ context.strokeStyle = trunkStyle.color;
+ context.lineWidth = trunkStyle.width;
+ context.setLineDash(style.lineDash ? [6, 4] : []);
+ context.stroke(path);
+ });
connectors.branches.forEach(({id, path}) => {
const style = {...rootStyle, ...this.model.metadata.nodes[id]};
this.linePaths.push({id, relation: false, path});
context.beginPath();
const selected = this.selectedEdge === id;
const hovered = this.hoveredLine === `edge:${id}`;
- const lineStyle = resolveLineStyle(lineStyles, style.lineColor, style.lineWidth, defaultLine, selected, hovered);
+ const lineStyle = resolveLineStyle(lineStyles, style.lineColor || this.themeColors?.get(id)?.lineColor,
+ style.lineWidth, defaultLine, selected, hovered);
context.strokeStyle = lineStyle.color;
context.lineWidth = lineStyle.width;
context.setLineDash(style.lineDash ? [6, 4] : []);
@@ -3596,12 +3610,12 @@ export class ListMindmapView {
remove.disabled = ids.includes(this.model.root.id) ||
this.model.root.virtual && this.model.root.children.every(node => ids.includes(node.id));
this.inspector.append(remove);
- appendMore();
- return;
}
- const style = this.model.metadata.nodes[id] || {};
- const change = (patch: Partial<ListMindmapNodeStyle>) => this.options.onNodeStyle?.(id, patch);
- this.inspector.append(this.buttons.get("relation"), this.buttons.get("summary"));
+ const change = (patch: Partial<ListMindmapNodeStyle>) => multiple ? this.options.onNodesStyle?.(ids, patch) :
+ this.options.onNodeStyle?.(id, patch);
+ if (!multiple) {
+ this.inspector.append(this.buttons.get("relation"), this.buttons.get("summary"));
+ }
const nodePalette = createElement("div", "mindmap-view__palette");
nodePalette.setAttribute("role", "group");
nodePalette.setAttribute("aria-label", this.label("color"));
@@ -3612,7 +3626,10 @@ export class ListMindmapView {
const button = this.makeButton("color", "iconFont", () => change({
textColor: item.color, backgroundColor: item.backgroundColor,
}));
- const selected = (style.textColor || "") === item.color && (style.backgroundColor || "") === item.backgroundColor;
+ const selected = ids.every(nodeID => {
+ const nodeStyle = this.model.metadata.nodes[nodeID] || {};
+ return (nodeStyle.textColor || "") === item.color && (nodeStyle.backgroundColor || "") === item.backgroundColor;
+ });
button.className = "color__square" + (selected ? " color__square--current" : "");
button.textContent = "A";
button.setAttribute("aria-label", item.label);
@@ -3626,6 +3643,11 @@ export class ListMindmapView {
nodePalette.append(manage);
}
this.inspector.append(nodePalette);
+ if (multiple) {
+ color(undefined, value => change({lineColor: value}), "listMindmapLineColor");
+ appendMore();
+ return;
+ }
const node = this.model.nodes.get(id);
if (node?.taskMarker !== undefined && this.options.onTaskMenu) {
const task = squareButton("checkToggle", "iconCheck", () => this.openTaskMenu(id, task));
diff --git a/kernel/model/transaction_list_mindmap.go b/kernel/model/transaction_list_mindmap.go
index d569f4e6c0..e9fbce0243 100644
--- a/kernel/model/transaction_list_mindmap.go
+++ b/kernel/model/transaction_list_mindmap.go
@@ -39,6 +39,9 @@ func validListMindmapMetadata(data map[string]any) bool {
if summaries, exists := data["summaries"]; exists && !validListMindmapSummaries(summaries, data["version"] == float64(2)) {
return false
}
+ if appearance, exists := data["appearance"]; exists && !validListMindmapAppearance(appearance) {
+ return false
+ }
validFields := func(value map[string]any, strings, numbers, booleans []string) bool {
for _, key := range strings {
if field, exists := value[key]; exists {
@@ -71,6 +74,12 @@ func validListMindmapMetadata(data map[string]any) bool {
[]string{"fontSize", "borderWidth", "borderRadius", "lineWidth"}, []string{"bold", "italic", "lineDash"}) {
return false
}
+ if value, exists := style["branchColor"]; exists {
+ slot, ok := value.(float64)
+ if !ok || math.IsNaN(slot) || math.IsInf(slot, 0) || slot < 0 || slot > 9007199254740991 || math.Trunc(slot) != slot {
+ return false
+ }
+ }
}
seen := map[string]bool{}
for _, value := range relations {
diff --git a/kernel/model/transaction_mindmap_appearance.go b/kernel/model/transaction_mindmap_appearance.go
new file mode 100644
index 0000000000..9040b26216
--- /dev/null
+++ b/kernel/model/transaction_mindmap_appearance.go
@@ -0,0 +1,30 @@
+package model
+
+import "regexp"
+
+var listMindmapColorPattern = regexp.MustCompile(`(?i)^#[0-9a-f]{6}$`)
+
+// 外观配置使用独立版本;只校验已知字段,扩展字段随文档原样保留。
+func validListMindmapAppearance(value any) bool {
+ data, ok := value.(map[string]any)
+ if !ok || data["version"] != float64(1) {
+ return false
+ }
+ palette, ok := data["palette"].([]any)
+ if !ok || len(palette) > 24 {
+ return false
+ }
+ for _, entry := range palette {
+ color, ok := entry.(string)
+ if !ok || !listMindmapColorPattern.MatchString(color) {
+ return false
+ }
+ }
+ if value, exists := data["backgroundColor"]; exists {
+ color, ok := value.(string)
+ if !ok || color != "" && !listMindmapColorPattern.MatchString(color) {
+ return false
+ }
+ }
+ return true
+}
diff --git a/kernel/model/transaction_mindmap_appearance_crypto_test.go b/kernel/model/transaction_mindmap_appearance_crypto_test.go
new file mode 100644
index 0000000000..12b209deea
--- /dev/null
+++ b/kernel/model/transaction_mindmap_appearance_crypto_test.go
@@ -0,0 +1,134 @@
+//go:build fts5 && (sqlcipher || libsqlcipher)
+
+package model
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "io"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/88250/lute/ast"
+ "github.com/siyuan-note/siyuan/kernel/filesys"
+ "github.com/siyuan-note/siyuan/kernel/treenode"
+ "github.com/siyuan-note/siyuan/kernel/util"
+)
+
+func TestListMindmapAppearanceEncrypted(t *testing.T) {
+ if os.Getenv("SIYUAN_TEST_MINDMAP_APPEARANCE") != "1" {
+ ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
+ defer cancel()
+ command := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestListMindmapAppearanceEncrypted$")
+ command.Env = append(os.Environ(), "SIYUAN_TEST_MINDMAP_APPEARANCE=1")
+ if output, err := command.CombinedOutput(); err != nil {
+ t.Fatalf("encrypted appearance subprocess failed: %v\n%s", err, output)
+ }
+ return
+ }
+ fixture := setupStructureTransactionTest(t)
+ setupFoldTransactionDatabase(t, fixture)
+ util.WorkspaceDir = filepath.Dir(util.HistoryDir)
+ const password = "mindmap-appearance-test"
+ if err := EnableEncryptedNotebook(password); err != nil {
+ t.Fatal(err)
+ }
+ boxID, err := CreateEncryptedBox("Appearance", password)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mountedEncryptedBoxes.Store(boxID, true)
+ docID := ast.NewNodeID()
+ tree := treenode.NewTree(boxID, "/"+docID+".sy", "/Appearance", "Appearance")
+ engine := util.NewLute()
+ _, source := engine.Md2BlockDOMTree("- Root\n - Alpha\n - Beta\n", false)
+ list := firstContentBlock(source.Root)
+ list.Unlink()
+ list.SetIALAttr(listMindmapViewAttr, "1")
+ var ids []string
+ ast.Walk(list, func(node *ast.Node, entering bool) ast.WalkStatus {
+ if entering && node.Type == ast.NodeListItem {
+ ids = append(ids, node.ID)
+ }
+ return ast.WalkContinue
+ })
+ legacy, err := os.ReadFile("testdata/list_mindmap_summary_v1.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+ original := strings.NewReplacer(`"root"`, `"`+ids[0]+`"`, `"a"`, `"`+ids[1]+`"`, `"b"`, `"`+ids[2]+`"`).Replace(strings.TrimSpace(string(legacy)))
+ list.SetIALAttr(listMindmapMetadataAttr, original)
+ tree.Root.AppendChild(list)
+ if _, err = filesys.WriteTree(tree); err != nil {
+ t.Fatal(err)
+ }
+ treenode.UpsertBlockTree(tree)
+ filename := filepath.Join(util.DataDir, boxID, tree.Path)
+ before, _ := os.ReadFile(filename)
+ if !util.IsCiphertext(before) {
+ t.Fatal("legacy document was not encrypted")
+ }
+ historyDir := filepath.Join(util.HistoryDir, "20261022000000-update")
+ generateTreeHistory(tree, historyDir)
+ historyFile := filepath.Join(historyDir, boxID, docID+".sy")
+ backup, _ := os.ReadFile(historyFile)
+ if !bytes.Equal(backup, before) {
+ t.Fatal("history did not preserve the legacy ciphertext")
+ }
+ var data map[string]any
+ _ = json.Unmarshal([]byte(original), &data)
+ data["appearance"] = map[string]any{"version": 1, "palette": []string{"#2563eb", "#15803d"}, "backgroundColor": "#1e1e1e"}
+ data["nodes"].(map[string]any)[ids[1]].(map[string]any)["branchColor"] = 0
+ styled, _ := json.Marshal(data)
+ for _, value := range []string{string(styled), original, string(styled)} {
+ attrs, _ := json.Marshal(map[string]string{listMindmapMetadataAttr: value})
+ tx := &Transaction{DoOperations: []*Operation{{Action: "setAttrs", ID: list.ID, Data: string(attrs)}}}
+ if err = PerformTxSync(tx); err != nil {
+ t.Fatal(err)
+ }
+ read, readErr := LoadTreeByBlockID(docID)
+ if readErr != nil || treenode.GetNodeInTree(read, list.ID).IALAttr(listMindmapMetadataAttr) != value {
+ t.Fatalf("appearance update or undo lost metadata: %v", readErr)
+ }
+ ciphertext, _ := os.ReadFile(filename)
+ if !util.IsCiphertext(ciphertext) || bytes.Contains(ciphertext, []byte("palette")) {
+ t.Fatal("appearance update wrote plaintext")
+ }
+ }
+ relative, _ := filepath.Rel(util.WorkspaceDir, historyFile)
+ _, _, content, _, err := GetDocHistoryContent(relative, "", false)
+ if err != nil || !strings.Contains(content, "Legacy summary") || strings.Contains(content, "#2563eb") {
+ t.Fatalf("legacy history cannot recover the original content: %v", err)
+ }
+ archivePath := exportSYZip(boxID, "/", "Appearance", []string{tree.Path}, false)
+ if archivePath == "" {
+ t.Fatal("encrypted document export failed")
+ }
+ archive := openExportArchive(t, archivePath)
+ entry := findArchiveFile(archive.File, "Appearance/"+docID+".sy")
+ if entry == nil {
+ t.Fatal("export omitted the styled document")
+ }
+ reader, err := entry.Open()
+ if err != nil {
+ t.Fatal(err)
+ }
+ exported, err := io.ReadAll(reader)
+ _ = reader.Close()
+ if err != nil || !json.Valid(exported) || !bytes.Contains(exported, []byte("#2563eb")) ||
+ !bytes.Contains(exported, []byte("Legacy summary")) {
+ t.Fatalf("export lost the appearance or legacy content: %v", err)
+ }
+ if err = RollbackDocHistory(relative); err != nil {
+ t.Fatal(err)
+ }
+ recovered, err := LoadTreeByBlockID(docID)
+ if err != nil || treenode.GetNodeInTree(recovered, list.ID).IALAttr(listMindmapMetadataAttr) != original {
+ t.Fatalf("legacy history recovery lost the original metadata: %v", err)
+ }
+}
diff --git a/kernel/model/transaction_mindmap_appearance_test.go b/kernel/model/transaction_mindmap_appearance_test.go
new file mode 100644
index 0000000000..87881cf651
--- /dev/null
+++ b/kernel/model/transaction_mindmap_appearance_test.go
@@ -0,0 +1,56 @@
+package model
+
+import (
+ "encoding/json"
+ "strings"
+ "testing"
+)
+
+func TestPruneListMindmapAppearance(t *testing.T) {
+ for _, version := range []string{"1", "2"} {
+ _, list, _ := mindmapTestTree()
+ appearance := `{"version":1,"palette":["#123456","#abcdef"],"backgroundColor":"#ffffff","extension":9007199254740993}`
+ original := `{"version":` + version + `,"appearance":` + appearance +
+ `,"nodes":{"child":{"branchColor":2,"lineColor":"red"},"deleted":{}},"relations":[]}`
+ list.SetIALAttr(listMindmapMetadataAttr, original)
+ next, changed := pruneListMindmapMetadata(list)
+ if !changed || strings.Contains(next, "deleted") || !strings.Contains(next, appearance) ||
+ !strings.Contains(next, `"branchColor":2`) || !strings.Contains(next, `"lineColor":"red"`) {
+ t.Fatalf("appearance or manual colors were lost during pruning: %s", next)
+ }
+ list.SetIALAttr(listMindmapMetadataAttr, next)
+ if again, changed := pruneListMindmapMetadata(list); changed || again != next {
+ t.Fatal("appearance normalization is not idempotent")
+ }
+ for _, invalid := range []string{`null`, `[]`, `{}`, `{"version":2,"palette":[]}`,
+ `{"version":1,"palette":["red"]}`, `{"version":1,"palette":[],"backgroundColor":"url(x)"}`} {
+ data := strings.Replace(original, appearance, invalid, 1)
+ list.SetIALAttr(listMindmapMetadataAttr, data)
+ if next, changed := pruneListMindmapMetadata(list); changed || next != data {
+ t.Fatalf("invalid or newer appearance was changed: %s", next)
+ }
+ }
+ for _, slot := range []string{`-1`, `0.5`, `null`, `"1"`, `9007199254740992`} {
+ data := strings.Replace(original, `"branchColor":2`, `"branchColor":`+slot, 1)
+ list.SetIALAttr(listMindmapMetadataAttr, data)
+ if next, changed := pruneListMindmapMetadata(list); changed || next != data {
+ t.Fatalf("invalid branch color was changed: %s", next)
+ }
+ }
+ }
+}
+
+func TestValidListMindmapAppearance(t *testing.T) {
+ for _, source := range []string{`{"version":1,"palette":[]}`, `{"version":1,"palette":["#AbCdEf"],"backgroundColor":""}`} {
+ var value any
+ _ = json.Unmarshal([]byte(source), &value)
+ if !validListMindmapAppearance(value) {
+ t.Fatalf("valid appearance rejected: %s", source)
+ }
+ }
+ var value any
+ _ = json.Unmarshal([]byte(`{"version":1,"palette":[`+strings.Repeat(`"#123456",`, 24)+`"#123456"]}`), &value)
+ if validListMindmapAppearance(value) {
+ t.Fatal("oversized palette accepted")
+ }
+}