From 869291050849dcad3c16f45c882623fb6abf42e1 Mon Sep 17 00:00:00 2001 From: KiriAky 107 Date: Sat, 5 Sep 2026 19:23:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=BF=AE=E5=A4=8D=E7=BA=B8?= =?UTF-8?q?=E9=A1=B5=E5=88=B7=E6=96=B0=E5=AE=BD=E5=BA=A6=E5=B9=B6=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E4=BE=A7=E6=A0=8F=E5=92=8C=E5=9B=BE=E8=A1=A8=E4=B8=BB?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/assets/themes/paper-moments.theme | 6 +- .../src/components/common/MarkdownContent.vue | 4 +- .../src/components/common/MermaidBlock.vue | 4 +- .../common/SecondarySidebar.spec.ts | 23 +++++++ .../components/common/SecondarySidebar.vue | 42 ++++++++++++- .../features/editor/VisualMarkdownEditor.vue | 20 +++++- .../features/workspace/FileTreePanel.spec.ts | 10 +++ .../src/features/workspace/FileTreePanel.vue | 7 +++ frontend/src/services/mermaidService.ts | 62 ++++++++++++------- frontend/src/services/mermaidTheme.spec.ts | 22 +++++++ 10 files changed, 165 insertions(+), 35 deletions(-) create mode 100644 frontend/src/components/common/SecondarySidebar.spec.ts create mode 100644 frontend/src/services/mermaidTheme.spec.ts diff --git a/frontend/src/assets/themes/paper-moments.theme b/frontend/src/assets/themes/paper-moments.theme index 42ebc3a..f92ee31 100644 --- a/frontend/src/assets/themes/paper-moments.theme +++ b/frontend/src/assets/themes/paper-moments.theme @@ -1,6 +1,6 @@ theme_id: paper-moments name: 纸间时光 · Paper Moments -version: 1.4.0 +version: 1.4.1 author: NotesAgent description: 奶油纸张、手帐虚线与粉蓝胶带,把每天的灵感好好收藏。 min_app_version: 0.2.0 @@ -141,7 +141,7 @@ license: MIT [data-theme="paper-moments"] .markdown-toolbar { background: #fff9e9; border-bottom: 1px dashed #b5a693; } [data-theme="paper-moments"] .milkdown-host { padding: 30px 24px 40px; } [data-theme="paper-moments"] .milkdown-host .milkdown { background: transparent; } -[data-theme="paper-moments"] .milkdown-host .ProseMirror { +[data-theme="paper-moments"] .visual-editor .milkdown-host .ProseMirror { width: 90%; max-width: none; position: relative; @@ -172,7 +172,7 @@ license: MIT [data-theme="paper-moments"] .editor-pane.source { margin: 20px; width: calc(100% - 40px); border: 1px solid #b5a693; border-radius: 8px; background: #fffef8; box-shadow: var(--shadow-md); } @media (max-width: 720px) { [data-theme="paper-moments"] .milkdown-host { padding: 20px 12px 28px; } - [data-theme="paper-moments"] .milkdown-host .ProseMirror { width: 100%; padding: 30px 18px 40px 38px; } + [data-theme="paper-moments"] .visual-editor .milkdown-host .ProseMirror { width: 100%; padding: 30px 18px 40px 38px; } } /* Warm neutral surfaces preserve the contrast of the selected Shiki palette. */ diff --git a/frontend/src/components/common/MarkdownContent.vue b/frontend/src/components/common/MarkdownContent.vue index 5fc08ac..dd11226 100644 --- a/frontend/src/components/common/MarkdownContent.vue +++ b/frontend/src/components/common/MarkdownContent.vue @@ -11,11 +11,11 @@ let renderVersion = 0 const diagramTheme = computed<'light' | 'dark'>(() => (themeStore.isDark ? 'dark' : 'light')) // 主题切换需要重渲染:Mermaid SVG 的配色在渲染时烘焙,无法靠 CSS 变量事后调整。 -watch([() => props.source, diagramTheme], async ([source, theme]) => { +watch([() => props.source, diagramTheme, () => themeStore.currentThemeId], async ([source, theme]) => { const version = ++renderVersion const result = await renderMarkdown(source, { theme }) if (version === renderVersion) html.value = result -}, { immediate: true }) +}, { immediate: true, flush: 'post' })