From 339ed53c2effd76e629f604602a4de0d75055ff6 Mon Sep 17 00:00:00 2001 From: landaiqing Date: Fri, 21 Nov 2025 00:03:03 +0800 Subject: [PATCH] :recycle: Refactor theme module --- .../src/components/tabs/TabContextMenu.vue | 4 +- frontend/src/i18n/locales/en-US.ts | 47 ----------- frontend/src/i18n/locales/zh-CN.ts | 48 ----------- frontend/src/views/editor/Editor.vue | 8 +- .../extensions/markdownPreview/styles.ts | 28 +++++++ frontend/src/views/editor/theme/base.ts | 83 +++++-------------- frontend/src/views/editor/theme/dark/aura.ts | 7 -- .../views/editor/theme/dark/default-dark.ts | 9 +- .../src/views/editor/theme/dark/dracula.ts | 7 -- .../views/editor/theme/dark/github-dark.ts | 7 -- .../views/editor/theme/dark/material-dark.ts | 7 -- .../src/views/editor/theme/dark/one-dark.ts | 9 -- .../views/editor/theme/dark/solarized-dark.ts | 7 -- .../editor/theme/dark/tokyo-night-storm.ts | 7 -- .../views/editor/theme/dark/tokyo-night.ts | 7 -- .../views/editor/theme/light/default-light.ts | 7 -- .../views/editor/theme/light/github-light.ts | 7 -- .../editor/theme/light/material-light.ts | 7 -- .../editor/theme/light/solarized-light.ts | 7 -- .../editor/theme/light/tokyo-night-day.ts | 7 -- frontend/src/views/editor/theme/types.ts | 34 +++----- 21 files changed, 70 insertions(+), 284 deletions(-) diff --git a/frontend/src/components/tabs/TabContextMenu.vue b/frontend/src/components/tabs/TabContextMenu.vue index f53b20f..ed9359b 100644 --- a/frontend/src/components/tabs/TabContextMenu.vue +++ b/frontend/src/components/tabs/TabContextMenu.vue @@ -147,7 +147,7 @@ onUnmounted(() => { padding: 8px 12px; cursor: pointer; font-size: 12px; - color: var(--text-muted); + color: var(--text-primary); transition: all 0.15s ease; gap: 8px; @@ -165,7 +165,7 @@ onUnmounted(() => { flex-shrink: 0; width: 12px; height: 12px; - color: var(--text-muted); + color: var(--text-primary); transition: color 0.15s ease; .menu-item:hover & { diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index e340d4b..041256d 100644 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -161,53 +161,6 @@ export default { customThemeColors: 'Custom Theme Colors', resetToDefault: 'Reset to Default', colorValue: 'Color Value', - themeColors: { - basic: 'Basic Colors', - text: 'Text Colors', - syntax: 'Syntax Highlighting', - interface: 'Interface Elements', - border: 'Borders & Dividers', - search: 'Search & Matching', - // Base Colors - background: 'Main Background', - backgroundSecondary: 'Secondary Background', - surface: 'Panel Background', - dropdownBackground: 'Dropdown Background', - dropdownBorder: 'Dropdown Border', - // Text Colors - foreground: 'Primary Text', - foregroundSecondary: 'Secondary Text', - comment: 'Comments', - // Syntax Highlighting - Core - keyword: 'Keywords', - string: 'Strings', - function: 'Functions', - number: 'Numbers', - operator: 'Operators', - variable: 'Variables', - type: 'Types', - // Syntax Highlighting - Extended - constant: 'Constants', - storage: 'Storage Type', - parameter: 'Parameters', - class: 'Class Names', - heading: 'Headings', - invalid: 'Invalid/Error', - regexp: 'Regular Expressions', - // Interface Elements - cursor: 'Cursor', - selection: 'Selection Background', - selectionBlur: 'Unfocused Selection', - activeLine: 'Active Line Highlight', - lineNumber: 'Line Numbers', - activeLineNumber: 'Active Line Number', - // Borders & Dividers - borderColor: 'Border Color', - borderLight: 'Light Border', - // Search & Matching - searchMatch: 'Search Match', - matchingBracket: 'Matching Bracket' - }, lineHeight: 'Line Height', tabSettings: 'Tab Settings', tabSize: 'Tab Size', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 5577374..fb73e94 100644 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -202,54 +202,6 @@ export default { customThemeColors: '自定义主题颜色', resetToDefault: '重置为默认', colorValue: '颜色值', - themeColors: { - basic: '基础色调', - text: '文本颜色', - syntax: '语法高亮', - interface: '界面元素', - border: '边框分割线', - search: '搜索匹配', - // 基础色调 - background: '主背景色', - backgroundSecondary: '次要背景色', - surface: '面板背景', - dropdownBackground: '下拉菜单背景', - dropdownBorder: '下拉菜单边框', - // 文本颜色 - foreground: '主文本色', - foregroundSecondary: '次要文本色', - comment: '注释色', - // 语法高亮 - 核心 - keyword: '关键字', - string: '字符串', - function: '函数名', - number: '数字', - operator: '操作符', - variable: '变量', - type: '类型', - // 语法高亮 - 扩展 - constant: '常量', - storage: '存储类型', - parameter: '参数', - class: '类名', - heading: '标题', - invalid: '无效内容', - regexp: '正则表达式', - // 界面元素 - cursor: '光标', - selection: '选中背景', - selectionBlur: '失焦选中背景', - activeLine: '当前行高亮', - lineNumber: '行号', - activeLineNumber: '活动行号', - // 边框和分割线 - borderColor: '边框色', - borderLight: '浅色边框', - // 搜索和匹配 - searchMatch: '搜索匹配', - matchingBracket: '匹配括号' - }, - hotkeyPreview: '预览:', none: '无', backup: { diff --git a/frontend/src/views/editor/Editor.vue b/frontend/src/views/editor/Editor.vue index 0df2849..6213e06 100644 --- a/frontend/src/views/editor/Editor.vue +++ b/frontend/src/views/editor/Editor.vue @@ -33,10 +33,10 @@ onMounted(async () => { await tabStore.initializeTab(); }); -onBeforeUnmount(() => { - editorStore.clearAllEditors(); - -}); +// onBeforeUnmount(() => { +// editorStore.clearAllEditors(); +// +// });