From d15ef9da00af918316e8f895623ccac15829bb5c Mon Sep 17 00:00:00 2001 From: cfq Date: Tue, 27 Jan 2026 09:35:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(editor):=20=E8=B0=83=E6=95=B4=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=A4=A7=E5=B0=8F=E5=B9=B6=E5=A2=9E=E5=BC=BA=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=AF=AD=E6=B3=95=E9=AB=98=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将编辑器字体大小从15px调整为16-17px,提升可读性 - 在编辑状态为链接语法标记添加.cm-md-syntax样式,使其可见且颜色正确 - 修复编辑器内链接和光标颜色,统一使用主题主色 --- src/codemirror/liveMarkdownDecorations.js | 15 + src/components/LivePreviewEditor.vue | 514 +++++++++++----------- src/main.css | 8 +- 3 files changed, 283 insertions(+), 254 deletions(-) diff --git a/src/codemirror/liveMarkdownDecorations.js b/src/codemirror/liveMarkdownDecorations.js index 07b57d9..db4ced0 100644 --- a/src/codemirror/liveMarkdownDecorations.js +++ b/src/codemirror/liveMarkdownDecorations.js @@ -399,6 +399,21 @@ const buildDecorations = (state, filePath) => { to: nodeTo, value: Decoration.mark({ class: 'cm-md-link-text' }) }) + } else { + // 编辑状态:给链接的语法标记添加样式,使其可见且颜色正确 + let cursor = node.node.cursor() + if (cursor.firstChild()) { + do { + const subType = cursor.type.name + if (subType === 'LinkMark' || subType === 'URL' || subType === 'LinkTitle') { + decorations.push({ + from: cursor.from, + to: cursor.to, + value: Decoration.mark({ class: 'cm-md-syntax' }) + }) + } + } while (cursor.nextSibling()) + } } } diff --git a/src/components/LivePreviewEditor.vue b/src/components/LivePreviewEditor.vue index d29ff5d..99cf730 100644 --- a/src/components/LivePreviewEditor.vue +++ b/src/components/LivePreviewEditor.vue @@ -1,299 +1,305 @@ diff --git a/src/main.css b/src/main.css index 983d9d2..280b584 100644 --- a/src/main.css +++ b/src/main.css @@ -10,10 +10,10 @@ --border-color: #f0f0f0; --hover-background: rgba(0, 0, 0, 0.04); --scrollbar-thumb: rgba(0, 0, 0, 0.28); - --app-font-size: 15px; - --editor-font-size: 15px; - --preview-font-size: 15px; - --preview-code-font-size: 15px; + --app-font-size: 16px; + --editor-font-size: 17px; + --preview-font-size: 16px; + --preview-code-font-size: 16px; } html,