From 9bcb3bf3a67c42ea47a1490c52178e39180104cb Mon Sep 17 00:00:00 2001 From: KiriAky 107 Date: Sun, 30 Aug 2026 22:31:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=BF=AE=E5=A4=8D=20Shiki=20?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E9=80=89=E6=8B=A9=E5=99=A8=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=9C=9F=E5=AE=9E=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/MarkdownContent.vue | 40 +++++++++---------- .../features/editor/VisualMarkdownEditor.vue | 2 +- frontend/src/features/themes/ThemesView.vue | 35 +++++++++++----- frontend/src/styles/motion.spec.ts | 5 +++ 4 files changed, 51 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/common/MarkdownContent.vue b/frontend/src/components/common/MarkdownContent.vue index 6580f2e..f799288 100644 --- a/frontend/src/components/common/MarkdownContent.vue +++ b/frontend/src/components/common/MarkdownContent.vue @@ -17,32 +17,32 @@ watch(() => props.source, async (source) => {
- diff --git a/frontend/src/features/themes/ThemesView.vue b/frontend/src/features/themes/ThemesView.vue index 1a93a5d..33ebc69 100644 --- a/frontend/src/features/themes/ThemesView.vue +++ b/frontend/src/features/themes/ThemesView.vue @@ -1,6 +1,15 @@ @@ -29,14 +51,7 @@ const themeStore = useThemeStore() .preference-panel { display: grid; gap: var(--space-xl); } .editor-preview { padding: var(--space-xl); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); background: var(--color-background-secondary); } .editor-preview p { margin: var(--space-sm) 0; } +.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); } .field small { color: var(--color-text-tertiary); } -.code-preview { overflow: auto; margin-top: var(--space-md); padding: 16px; border: 1px solid var(--color-code-border); border-radius: 6px; background: var(--color-code-background); color: var(--color-code-text); font: 13px/1.45 var(--font-ui-mono); } -:global([data-code-theme='github-light']) .code-keyword { color: #cf222e; } -:global([data-code-theme='github-light']) .code-variable { color: #24292f; } -:global([data-code-theme='github-light']) .code-function { color: #8250df; } -:global([data-code-theme='github-light']) .code-string { color: #0a3069; } -:global([data-code-theme='github-dark']) .code-keyword { color: #ff7b72; } -:global([data-code-theme='github-dark']) .code-variable { color: #c9d1d9; } -:global([data-code-theme='github-dark']) .code-function { color: #d2a8ff; } -:global([data-code-theme='github-dark']) .code-string { color: #a5d6ff; } +.code-theme-preview { margin-top: var(--space-md); } diff --git a/frontend/src/styles/motion.spec.ts b/frontend/src/styles/motion.spec.ts index 59f8e82..49cad55 100644 --- a/frontend/src/styles/motion.spec.ts +++ b/frontend/src/styles/motion.spec.ts @@ -10,6 +10,7 @@ const globalStyles = [ const markdownStyles = [ new URL('../features/editor/VisualMarkdownEditor.vue', import.meta.url), + new URL('../features/themes/ThemesView.vue', import.meta.url), new URL('../components/common/MarkdownContent.vue', import.meta.url), ].map((path) => readFileSync(path, 'utf8')).join('\n') @@ -36,4 +37,8 @@ describe('轻量动效基线', () => { expect(markdownStyles).toContain('var(--color-markdown-grid)') expect(markdownStyles).toContain('var(--color-markdown-marker)') }) + + it('不混用可能丢失后代选择器的 scoped global 写法', () => { + expect(markdownStyles).not.toMatch(/:global\([^\n]+\)\s+\./) + }) })