🎨 Refactor config service
This commit is contained in:
@@ -10,7 +10,7 @@ import {Create as $Create} from "@wailsio/runtime";
|
||||
import * as time$0 from "../../../time/models.js";
|
||||
|
||||
/**
|
||||
* AppConfig 应用配置
|
||||
* AppConfig 应用配置 - 包含业务配置和路径配置
|
||||
*/
|
||||
export class AppConfig {
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ export class AppConfig {
|
||||
/**
|
||||
* 路径配置
|
||||
*/
|
||||
"paths": PathConfig;
|
||||
"paths": PathsConfig;
|
||||
|
||||
/**
|
||||
* 配置元数据
|
||||
@@ -34,7 +34,7 @@ export class AppConfig {
|
||||
this["editor"] = (new EditorConfig());
|
||||
}
|
||||
if (!("paths" in $$source)) {
|
||||
this["paths"] = (new PathConfig());
|
||||
this["paths"] = (new PathsConfig());
|
||||
}
|
||||
if (!("metadata" in $$source)) {
|
||||
this["metadata"] = (new ConfigMetadata());
|
||||
@@ -108,11 +108,6 @@ export class EditorConfig {
|
||||
*/
|
||||
"fontSize": number;
|
||||
|
||||
/**
|
||||
* 文件保存的编码
|
||||
*/
|
||||
"encoding": EncodingType;
|
||||
|
||||
/**
|
||||
* 是否启用Tab缩进
|
||||
*/
|
||||
@@ -138,9 +133,6 @@ export class EditorConfig {
|
||||
if (!("fontSize" in $$source)) {
|
||||
this["fontSize"] = 0;
|
||||
}
|
||||
if (!("encoding" in $$source)) {
|
||||
this["encoding"] = ("" as EncodingType);
|
||||
}
|
||||
if (!("enableTabIndent" in $$source)) {
|
||||
this["enableTabIndent"] = false;
|
||||
}
|
||||
@@ -166,56 +158,6 @@ export class EditorConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EncodingType 定义文件编码格式类型
|
||||
*/
|
||||
export enum EncodingType {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
/**
|
||||
* EncodingUTF8 UTF-8编码
|
||||
*/
|
||||
EncodingUTF8 = "UTF-8",
|
||||
|
||||
/**
|
||||
* EncodingUTF8BOM UTF-8带BOM编码
|
||||
*/
|
||||
EncodingUTF8BOM = "UTF-8-BOM",
|
||||
|
||||
/**
|
||||
* EncodingUTF16LE UTF-16小端编码
|
||||
*/
|
||||
EncodingUTF16LE = "UTF-16 LE",
|
||||
|
||||
/**
|
||||
* EncodingUTF16BE UTF-16大端编码
|
||||
*/
|
||||
EncodingUTF16BE = "UTF-16 BE",
|
||||
|
||||
/**
|
||||
* EncodingISO88591 ISO-8859-1编码
|
||||
*/
|
||||
EncodingISO88591 = "ISO-8859-1",
|
||||
|
||||
/**
|
||||
* EncodingGB18030 GB18030编码
|
||||
*/
|
||||
EncodingGB18030 = "GB18030",
|
||||
|
||||
/**
|
||||
* EncodingGBK GBK编码
|
||||
*/
|
||||
EncodingGBK = "GBK",
|
||||
|
||||
/**
|
||||
* EncodingBig5 Big5编码
|
||||
*/
|
||||
EncodingBig5 = "Big5",
|
||||
};
|
||||
|
||||
/**
|
||||
* LanguageType 语言类型定义
|
||||
*/
|
||||
@@ -237,37 +179,45 @@ export enum LanguageType {
|
||||
};
|
||||
|
||||
/**
|
||||
* PathConfig 定义配置文件路径相关配置
|
||||
* PathsConfig 路径配置集合
|
||||
*/
|
||||
export class PathConfig {
|
||||
/**
|
||||
* 根目录
|
||||
*/
|
||||
"rootDir": string;
|
||||
|
||||
export class PathsConfig {
|
||||
/**
|
||||
* 配置文件路径
|
||||
*/
|
||||
"configPath": string;
|
||||
|
||||
/** Creates a new PathConfig instance. */
|
||||
constructor($$source: Partial<PathConfig> = {}) {
|
||||
if (!("rootDir" in $$source)) {
|
||||
this["rootDir"] = "";
|
||||
}
|
||||
/**
|
||||
* 日志文件路径
|
||||
*/
|
||||
"logPath": string;
|
||||
|
||||
/**
|
||||
* 数据存储路径
|
||||
*/
|
||||
"dataPath": string;
|
||||
|
||||
/** Creates a new PathsConfig instance. */
|
||||
constructor($$source: Partial<PathsConfig> = {}) {
|
||||
if (!("configPath" in $$source)) {
|
||||
this["configPath"] = "";
|
||||
}
|
||||
if (!("logPath" in $$source)) {
|
||||
this["logPath"] = "";
|
||||
}
|
||||
if (!("dataPath" in $$source)) {
|
||||
this["dataPath"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new PathConfig instance from a string or object.
|
||||
* Creates a new PathsConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): PathConfig {
|
||||
static createFrom($$source: any = {}): PathsConfig {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new PathConfig($$parsedSource as Partial<PathConfig>);
|
||||
return new PathsConfig($$parsedSource as Partial<PathsConfig>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,5 +243,5 @@ export enum TabType {
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = EditorConfig.createFrom;
|
||||
const $$createType1 = PathConfig.createFrom;
|
||||
const $$createType1 = PathsConfig.createFrom;
|
||||
const $$createType2 = ConfigMetadata.createFrom;
|
||||
|
@@ -12,13 +12,13 @@ import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as models$0 from "../models/models.js";
|
||||
import * as models$0 from "../../models/models.js";
|
||||
|
||||
/**
|
||||
* GetConfig 获取完整应用配置
|
||||
*/
|
||||
export function GetConfig(): Promise<models$0.AppConfig | null> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1013336538) as any;
|
||||
let $resultPromise = $Call.ByID(3332910023) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
}) as any;
|
||||
@@ -26,11 +26,19 @@ export function GetConfig(): Promise<models$0.AppConfig | null> & { cancel(): vo
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetConfigPath 获取当前配置文件路径
|
||||
*/
|
||||
export function GetConfigPath(): Promise<string> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2145796624) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetEditorConfig 获取编辑器配置
|
||||
*/
|
||||
export function GetEditorConfig(): Promise<models$0.EditorConfig> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3648153351) as any;
|
||||
let $resultPromise = $Call.ByID(3738882774) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType2($result);
|
||||
}) as any;
|
||||
@@ -42,7 +50,7 @@ export function GetEditorConfig(): Promise<models$0.EditorConfig> & { cancel():
|
||||
* GetLanguage 获取当前语言设置
|
||||
*/
|
||||
export function GetLanguage(): Promise<models$0.LanguageType> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3409375894) as any;
|
||||
let $resultPromise = $Call.ByID(1762264443) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
@@ -50,7 +58,7 @@ export function GetLanguage(): Promise<models$0.LanguageType> & { cancel(): void
|
||||
* GetMetadata 获取配置元数据
|
||||
*/
|
||||
export function GetMetadata(): Promise<models$0.ConfigMetadata> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3276720617) as any;
|
||||
let $resultPromise = $Call.ByID(356327488) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType3($result);
|
||||
}) as any;
|
||||
@@ -59,10 +67,10 @@ export function GetMetadata(): Promise<models$0.ConfigMetadata> & { cancel(): vo
|
||||
}
|
||||
|
||||
/**
|
||||
* GetPathConfig 获取路径配置
|
||||
* GetPaths 获取路径配置
|
||||
*/
|
||||
export function GetPathConfig(): Promise<models$0.PathConfig> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2053285689) as any;
|
||||
export function GetPaths(): Promise<models$0.PathsConfig> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1115810463) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType4($result);
|
||||
}) as any;
|
||||
@@ -74,7 +82,7 @@ export function GetPathConfig(): Promise<models$0.PathConfig> & { cancel(): void
|
||||
* ResetConfig 重置为默认配置
|
||||
*/
|
||||
export function ResetConfig(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3593047389) as any;
|
||||
let $resultPromise = $Call.ByID(2265390548) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
@@ -82,7 +90,7 @@ export function ResetConfig(): Promise<void> & { cancel(): void } {
|
||||
* SaveConfig 保存完整应用配置
|
||||
*/
|
||||
export function SaveConfig(config: models$0.AppConfig | null): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(616684383, config) as any;
|
||||
let $resultPromise = $Call.ByID(2710445504, config) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
@@ -90,7 +98,15 @@ export function SaveConfig(config: models$0.AppConfig | null): Promise<void> & {
|
||||
* SetLanguage 设置语言
|
||||
*/
|
||||
export function SetLanguage(language: models$0.LanguageType): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(814725002, language) as any;
|
||||
let $resultPromise = $Call.ByID(2553541807, language) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateConfigPath 更新配置文件路径
|
||||
*/
|
||||
export function UpdateConfigPath(newPath: string): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(251712339, newPath) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
@@ -98,7 +114,7 @@ export function SetLanguage(language: models$0.LanguageType): Promise<void> & {
|
||||
* UpdateEditorConfig 更新编辑器配置
|
||||
*/
|
||||
export function UpdateEditorConfig(editorConfig: models$0.EditorConfig): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1237949666, editorConfig) as any;
|
||||
let $resultPromise = $Call.ByID(420530601, editorConfig) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
@@ -106,15 +122,15 @@ export function UpdateEditorConfig(editorConfig: models$0.EditorConfig): Promise
|
||||
* UpdateMetadata 更新配置元数据
|
||||
*/
|
||||
export function UpdateMetadata(metadata: models$0.ConfigMetadata): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3353893284, metadata) as any;
|
||||
let $resultPromise = $Call.ByID(1687760751, metadata) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdatePathConfig 更新路径配置
|
||||
* UpdatePaths 更新路径配置
|
||||
*/
|
||||
export function UpdatePathConfig(pathConfig: models$0.PathConfig): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1492772004, pathConfig) as any;
|
||||
export function UpdatePaths(paths: models$0.PathsConfig): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3466187518, paths) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
@@ -123,4 +139,4 @@ const $$createType0 = models$0.AppConfig.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
const $$createType2 = models$0.EditorConfig.createFrom;
|
||||
const $$createType3 = models$0.ConfigMetadata.createFrom;
|
||||
const $$createType4 = models$0.PathConfig.createFrom;
|
||||
const $$createType4 = models$0.PathsConfig.createFrom;
|
@@ -5,7 +5,6 @@ import {useLogStore} from '@/stores/logStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ref } from 'vue';
|
||||
import {SUPPORTED_LOCALES, setLocale, SupportedLocaleType} from '@/i18n';
|
||||
import { EncodingType } from '@/../bindings/voidraft/internal/models/models';
|
||||
|
||||
const editorStore = useEditorStore();
|
||||
const configStore = useConfigStore();
|
||||
@@ -14,20 +13,6 @@ const { t, locale } = useI18n();
|
||||
|
||||
// 语言下拉菜单
|
||||
const showLanguageMenu = ref(false);
|
||||
// 编码下拉菜单
|
||||
const showEncodingMenu = ref(false);
|
||||
|
||||
// 支持的编码格式
|
||||
const SUPPORTED_ENCODINGS = [
|
||||
{ code: EncodingType.EncodingUTF8, name: 'UTF-8' },
|
||||
{ code: EncodingType.EncodingUTF8BOM, name: 'UTF-8 with BOM' },
|
||||
{ code: EncodingType.EncodingUTF16LE, name: 'UTF-16 LE' },
|
||||
{ code: EncodingType.EncodingUTF16BE, name: 'UTF-16 BE' },
|
||||
{ code: EncodingType.EncodingISO88591, name: 'ISO-8859-1' },
|
||||
{ code: EncodingType.EncodingGB18030, name: 'GB18030' },
|
||||
{ code: EncodingType.EncodingGBK, name: 'GBK' },
|
||||
{ code: EncodingType.EncodingBig5, name: 'Big5' }
|
||||
];
|
||||
|
||||
// 切换语言
|
||||
const changeLanguage = (localeCode: SupportedLocaleType) => {
|
||||
@@ -38,30 +23,10 @@ const changeLanguage = (localeCode: SupportedLocaleType) => {
|
||||
// 切换语言菜单显示
|
||||
const toggleLanguageMenu = () => {
|
||||
showLanguageMenu.value = !showLanguageMenu.value;
|
||||
if (showLanguageMenu.value) {
|
||||
showEncodingMenu.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 切换编码
|
||||
const changeEncoding = (encoding: EncodingType) => {
|
||||
configStore.setEncoding(encoding);
|
||||
showEncodingMenu.value = false;
|
||||
};
|
||||
|
||||
// 切换编码菜单显示
|
||||
const toggleEncodingMenu = () => {
|
||||
showEncodingMenu.value = !showEncodingMenu.value;
|
||||
if (showEncodingMenu.value) {
|
||||
showLanguageMenu.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 获取编码名称
|
||||
const getEncodingDisplayName = (encoding: EncodingType) => {
|
||||
const encodingItem = SUPPORTED_ENCODINGS.find(item => item.code === encoding);
|
||||
return encodingItem ? encodingItem.name : encoding;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -100,25 +65,6 @@ const getEncodingDisplayName = (encoding: EncodingType) => {
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<!-- 编码选择按钮 -->
|
||||
<div class="selector-dropdown">
|
||||
<button class="selector-btn" @click="toggleEncodingMenu">
|
||||
{{ getEncodingDisplayName(configStore.config.encoding) }}
|
||||
<span class="arrow">▲</span>
|
||||
</button>
|
||||
<div class="selector-menu" v-if="showEncodingMenu">
|
||||
<div
|
||||
v-for="encoding in SUPPORTED_ENCODINGS"
|
||||
:key="encoding.code"
|
||||
class="selector-option"
|
||||
:class="{ active: configStore.config.encoding === encoding.code }"
|
||||
@click="changeEncoding(encoding.code)"
|
||||
>
|
||||
{{ encoding.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 语言切换按钮 -->
|
||||
<div class="selector-dropdown">
|
||||
<button class="selector-btn" @click="toggleLanguageMenu">
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import {createI18n} from 'vue-i18n';
|
||||
import messages from './locales';
|
||||
import { GetLanguage, SetLanguage } from '@/../bindings/voidraft/internal/services/configservice';
|
||||
import { ConfigService } from '@/../bindings/voidraft/internal/services/config';
|
||||
import { LanguageType } from '@/../bindings/voidraft/internal/models';
|
||||
|
||||
// 定义支持的语言类型
|
||||
@@ -40,7 +40,7 @@ const i18n = createI18n({
|
||||
});
|
||||
|
||||
// 立即从后端获取语言设置
|
||||
GetLanguage().then(lang => {
|
||||
ConfigService.GetLanguage().then(lang => {
|
||||
if (lang) {
|
||||
i18n.global.locale = lang as any;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ GetLanguage().then(lang => {
|
||||
export const setLocale = (locale: SupportedLocaleType) => {
|
||||
if (SUPPORTED_LOCALES.some(l => l.code === locale)) {
|
||||
// 更新后端配置
|
||||
SetLanguage(locale as LanguageType)
|
||||
ConfigService.SetLanguage(locale as LanguageType)
|
||||
.then(() => {
|
||||
i18n.global.locale = locale;
|
||||
document.documentElement.setAttribute('lang', locale);
|
||||
|
@@ -2,11 +2,9 @@ import {defineStore} from 'pinia';
|
||||
import {ref, watch} from 'vue';
|
||||
import {useDebounceFn} from '@vueuse/core';
|
||||
import {
|
||||
GetEditorConfig,
|
||||
ResetConfig,
|
||||
UpdateEditorConfig
|
||||
} from '@/../bindings/voidraft/internal/services/configservice';
|
||||
import {EditorConfig, TabType, EncodingType} from '@/../bindings/voidraft/internal/models/models';
|
||||
ConfigService
|
||||
} from '@/../bindings/voidraft/internal/services/config';
|
||||
import {EditorConfig, TabType} from '@/../bindings/voidraft/internal/models/models';
|
||||
import {useLogStore} from './logStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
@@ -20,24 +18,11 @@ const DEFAULT_TAB_SIZE = 4;
|
||||
const MIN_TAB_SIZE = 2;
|
||||
const MAX_TAB_SIZE = 8;
|
||||
|
||||
// 支持的编码
|
||||
const SUPPORTED_ENCODINGS = [
|
||||
EncodingType.EncodingUTF8,
|
||||
EncodingType.EncodingUTF8BOM,
|
||||
EncodingType.EncodingUTF16LE,
|
||||
EncodingType.EncodingUTF16BE,
|
||||
EncodingType.EncodingISO88591,
|
||||
EncodingType.EncodingGB18030,
|
||||
EncodingType.EncodingGBK,
|
||||
EncodingType.EncodingBig5
|
||||
];
|
||||
|
||||
// 配置项限制定义
|
||||
const CONFIG_LIMITS = {
|
||||
fontSize: { min: MIN_FONT_SIZE, max: MAX_FONT_SIZE, default: DEFAULT_FONT_SIZE },
|
||||
tabSize: { min: MIN_TAB_SIZE, max: MAX_TAB_SIZE, default: DEFAULT_TAB_SIZE },
|
||||
tabType: { values: [TabType.TabTypeSpaces, TabType.TabTypeTab], default: TabType.TabTypeSpaces },
|
||||
encoding: { values: SUPPORTED_ENCODINGS, default: EncodingType.EncodingUTF8 }
|
||||
};
|
||||
|
||||
export const useConfigStore = defineStore('config', () => {
|
||||
@@ -48,7 +33,6 @@ export const useConfigStore = defineStore('config', () => {
|
||||
// 配置状态
|
||||
const config = ref<EditorConfig>(new EditorConfig({
|
||||
fontSize: DEFAULT_FONT_SIZE,
|
||||
encoding: EncodingType.EncodingUTF8,
|
||||
enableTabIndent: true,
|
||||
tabSize: DEFAULT_TAB_SIZE,
|
||||
tabType: TabType.TabTypeSpaces
|
||||
@@ -60,7 +44,7 @@ export const useConfigStore = defineStore('config', () => {
|
||||
// 从后端加载配置
|
||||
async function loadConfigFromBackend() {
|
||||
try {
|
||||
config.value = await GetEditorConfig();
|
||||
config.value = await ConfigService.GetEditorConfig();
|
||||
|
||||
// 验证并纠正配置
|
||||
validateAndFixConfig();
|
||||
@@ -110,15 +94,6 @@ export const useConfigStore = defineStore('config', () => {
|
||||
hasChanges = true;
|
||||
}
|
||||
|
||||
// 验证编码类型是否合法
|
||||
if (!CONFIG_LIMITS.encoding.values.includes(config.value.encoding)) {
|
||||
const oldValue = config.value.encoding;
|
||||
config.value.encoding = CONFIG_LIMITS.encoding.default;
|
||||
|
||||
logStore.warning(t('config.encodingFixed'));
|
||||
hasChanges = true;
|
||||
}
|
||||
|
||||
// 如果配置被修正,保存回后端
|
||||
if (hasChanges && configLoaded.value) {
|
||||
saveConfigToBackend();
|
||||
@@ -128,7 +103,7 @@ export const useConfigStore = defineStore('config', () => {
|
||||
// 使用防抖保存配置到后端
|
||||
const saveConfigToBackend = useDebounceFn(async () => {
|
||||
try {
|
||||
await UpdateEditorConfig(config.value);
|
||||
await ConfigService.UpdateEditorConfig(config.value);
|
||||
logStore.info(t('config.saveSuccess'));
|
||||
} catch (error) {
|
||||
console.error('Failed to save configuration:', error);
|
||||
@@ -182,22 +157,11 @@ export const useConfigStore = defineStore('config', () => {
|
||||
? TabType.TabTypeTab
|
||||
: TabType.TabTypeSpaces;
|
||||
}
|
||||
|
||||
// 设置编码类型
|
||||
function setEncoding(encoding: string) {
|
||||
// 验证编码是否有效的EncodingType
|
||||
const encodingType = encoding as EncodingType;
|
||||
if (SUPPORTED_ENCODINGS.includes(encodingType)) {
|
||||
config.value.encoding = encodingType;
|
||||
} else {
|
||||
logStore.warning(t('config.invalidEncoding'));
|
||||
}
|
||||
}
|
||||
|
||||
// 重置为默认配置
|
||||
async function resetToDefaults() {
|
||||
try {
|
||||
await ResetConfig();
|
||||
await ConfigService.ResetConfig();
|
||||
await loadConfigFromBackend();
|
||||
logStore.info(t('config.resetSuccess'));
|
||||
} catch (error) {
|
||||
@@ -217,7 +181,6 @@ export const useConfigStore = defineStore('config', () => {
|
||||
DEFAULT_FONT_SIZE,
|
||||
MIN_TAB_SIZE,
|
||||
MAX_TAB_SIZE,
|
||||
SUPPORTED_ENCODINGS,
|
||||
|
||||
// 核心方法
|
||||
loadConfigFromBackend,
|
||||
@@ -230,9 +193,6 @@ export const useConfigStore = defineStore('config', () => {
|
||||
decreaseFontSize: () => adjustFontSize(-1),
|
||||
resetFontSize: () => updateConfig('fontSize', DEFAULT_FONT_SIZE),
|
||||
|
||||
// 编码操作
|
||||
setEncoding,
|
||||
|
||||
// Tab操作
|
||||
toggleTabIndent: () => updateConfig('enableTabIndent', val => !val),
|
||||
increaseTabSize: () => adjustTabSize(1),
|
||||
|
Reference in New Issue
Block a user