diff --git a/frontend/bindings/voidraft/internal/models/models.ts b/frontend/bindings/voidraft/internal/models/models.ts index 6b1ebe5..a5950c0 100644 --- a/frontend/bindings/voidraft/internal/models/models.ts +++ b/frontend/bindings/voidraft/internal/models/models.ts @@ -109,11 +109,6 @@ export class AppearanceConfig { */ "language": LanguageType; - /** - * 编辑器主题 - */ - "theme": ThemeType; - /** * 系统界面主题 */ @@ -124,9 +119,6 @@ export class AppearanceConfig { if (!("language" in $$source)) { this["language"] = ("" as LanguageType); } - if (!("theme" in $$source)) { - this["theme"] = ("" as ThemeType); - } if (!("systemTheme" in $$source)) { this["systemTheme"] = ("" as SystemThemeType); } @@ -562,76 +554,6 @@ export enum TabType { TabTypeTab = "tab", }; -/** - * ThemeType 主题类型定义 - */ -export enum ThemeType { - /** - * The Go zero value for the underlying type of the enum. - */ - $zero = "", - - /** - * ThemeDefaultDark 默认深色主题 - */ - ThemeDefaultDark = "default-dark", - - /** - * ThemeDracula Dracula主题 - */ - ThemeDracula = "dracula", - - /** - * ThemeAura Aura主题 - */ - ThemeAura = "aura", - - /** - * ThemeGithubDark GitHub深色主题 - */ - ThemeGithubDark = "github-dark", - - /** - * ThemeGithubLight GitHub浅色主题 - */ - ThemeGithubLight = "github-light", - - /** - * ThemeMaterialDark Material深色主题 - */ - ThemeMaterialDark = "material-dark", - - /** - * ThemeMaterialLight Material浅色主题 - */ - ThemeMaterialLight = "material-light", - - /** - * ThemeSolarizedDark Solarized深色主题 - */ - ThemeSolarizedDark = "solarized-dark", - - /** - * ThemeSolarizedLight Solarized浅色主题 - */ - ThemeSolarizedLight = "solarized-light", - - /** - * ThemeTokyoNight Tokyo Night主题 - */ - ThemeTokyoNight = "tokyo-night", - - /** - * ThemeTokyoNightStorm Tokyo Night Storm主题 - */ - ThemeTokyoNightStorm = "tokyo-night-storm", - - /** - * ThemeTokyoNightDay Tokyo Night Day主题 - */ - ThemeTokyoNightDay = "tokyo-night-day", -}; - /** * UpdatesConfig 更新设置配置 */ diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 3baa618..6719df7 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -8,6 +8,7 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + BlockLanguageSelector: typeof import('./src/components/toolbar/BlockLanguageSelector.vue')['default'] LinuxTitleBar: typeof import('./src/components/titlebar/LinuxTitleBar.vue')['default'] MacOSTitleBar: typeof import('./src/components/titlebar/MacOSTitleBar.vue')['default'] MemoryMonitor: typeof import('./src/components/monitor/MemoryMonitor.vue')['default'] diff --git a/frontend/src/App.vue b/frontend/src/App.vue index b332d48..eba1417 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -2,23 +2,20 @@ import { onMounted } from 'vue'; import { useConfigStore } from '@/stores/configStore'; import { useSystemStore } from '@/stores/systemStore'; -import { useSystemTheme } from '@/composables/useSystemTheme'; import WindowTitleBar from '@/components/titlebar/WindowTitleBar.vue'; const configStore = useConfigStore(); const systemStore = useSystemStore(); -const { setTheme } = useSystemTheme(); // 应用启动时加载配置和初始化系统信息 onMounted(async () => { // 并行初始化配置和系统信息 await Promise.all([ configStore.initConfig(), - systemStore.initializeSystemInfo() + systemStore.initializeSystemInfo(), ]); await configStore.initializeLanguage(); - setTheme(configStore.config.appearance.systemTheme); }); diff --git a/frontend/src/components/toolbar/BlockLanguageSelector.vue b/frontend/src/components/toolbar/BlockLanguageSelector.vue new file mode 100644 index 0000000..4fc2ec6 --- /dev/null +++ b/frontend/src/components/toolbar/BlockLanguageSelector.vue @@ -0,0 +1,317 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/toolbar/Toolbar.vue b/frontend/src/components/toolbar/Toolbar.vue index e49b46b..fc1ea03 100644 --- a/frontend/src/components/toolbar/Toolbar.vue +++ b/frontend/src/components/toolbar/Toolbar.vue @@ -6,33 +6,15 @@ import { useEditorStore } from '@/stores/editorStore'; import { useErrorHandler } from '@/utils/errorHandler'; import * as runtime from '@wailsio/runtime'; import { useRouter } from 'vue-router'; +import BlockLanguageSelector from './BlockLanguageSelector.vue'; const editorStore = useEditorStore(); const configStore = useConfigStore(); const { safeCall } = useErrorHandler(); -const { t, locale } = useI18n(); +const { t } = useI18n(); const router = useRouter(); -// 语言下拉菜单 -const showLanguageMenu = ref(false); -const supportedLanguages = [ - { code: 'zh-CN', name: '简体中文' }, - { code: 'en-US', name: 'English' } -]; - -const toggleLanguageMenu = () => { - showLanguageMenu.value = !showLanguageMenu.value; -}; - -const closeLanguageMenu = () => { - showLanguageMenu.value = false; -}; - -const changeLanguage = async (langCode: string) => { - await safeCall(() => configStore.setLanguage(langCode as any), 'language.changeFailed'); - closeLanguageMenu(); -}; // 设置窗口置顶 const setWindowAlwaysOnTop = async (isTop: boolean) => { @@ -95,20 +77,9 @@ watch(isLoaded, async (newLoaded) => { {{ configStore.config.editing.fontSize }}px - - - - {{ t('toolbar.tabType.' + (configStore.config.editing.tabType === 'spaces' ? 'spaces' : 'tab')) }} - - - - {{ configStore.config.editing.tabSize }} - - - + + +
{
- -
- -
-
- {{ t(`languages.${lang.code}`) }} -
-
-
+