From 470e34e7a888db0582bce4648f8236402b37acac Mon Sep 17 00:00:00 2001 From: gaoziman <2942894660@qq.com> Date: Sun, 21 Dec 2025 01:56:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=A3=E7=A0=81=E5=9D=97):=20?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20CSS=20=E5=8F=98=E9=87=8F=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=9D=97=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 CSS 变量替代硬编码颜色值 - 添加 Mac 风格红黄绿交通灯按钮装饰 - 优化工具栏布局和间距 - 支持亮色/暗色主题自动切换 - 改进行号显示样式 --- src/components/markdown/CodeBlock.tsx | 46 ++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/src/components/markdown/CodeBlock.tsx b/src/components/markdown/CodeBlock.tsx index 73cbfe2..6d548b0 100644 --- a/src/components/markdown/CodeBlock.tsx +++ b/src/components/markdown/CodeBlock.tsx @@ -84,16 +84,38 @@ export function CodeBlock({ const lines = code.split('\n'); return ( -
+
{/* 顶部工具栏 */} -
- {language || 'code'} +
+ {/* 左侧:Mac 红黄绿按钮 + 语言 */} +
+ {/* Mac Traffic Lights - 通过 CSS 变量控制显示 */} +
+ + + +
+ {language || 'code'} +
+ + {/* 右侧:操作按钮 */}
{/* HTML 预览按钮 */} {isHtmlPreviewable && (
{/* 代码区域 */} -
+
{showLineNumbers && ( -
+
{lines.map((_, index) => (
{index + 1}
@@ -146,6 +175,7 @@ export function CodeBlock({ >