✨ Added tab functionality and optimized related configurations
This commit is contained in:
@@ -7,11 +7,13 @@ import {createWheelZoomHandler} from './basic/wheelZoomExtension';
|
||||
import Toolbar from '@/components/toolbar/Toolbar.vue';
|
||||
import {useWindowStore} from "@/stores/windowStore";
|
||||
import LoadingScreen from '@/components/loading/LoadingScreen.vue';
|
||||
import {useTabStore} from "@/stores/tabStore";
|
||||
|
||||
const editorStore = useEditorStore();
|
||||
const documentStore = useDocumentStore();
|
||||
const configStore = useConfigStore();
|
||||
const windowStore = useWindowStore();
|
||||
const tabStore = useTabStore();
|
||||
|
||||
const editorElement = ref<HTMLElement | null>(null);
|
||||
|
||||
@@ -33,6 +35,8 @@ onMounted(async () => {
|
||||
// 设置编辑器容器
|
||||
editorStore.setEditorContainer(editorElement.value);
|
||||
|
||||
await tabStore.initializeTab();
|
||||
|
||||
// 添加滚轮事件监听
|
||||
editorElement.value.addEventListener('wheel', wheelHandler, {passive: false});
|
||||
});
|
||||
|
||||
@@ -285,19 +285,6 @@ export class TranslationTooltip implements TooltipView {
|
||||
this.translate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 寻找替代的目标语言
|
||||
*/
|
||||
private findAlternativeTargetLanguage(): void {
|
||||
const options = Array.from(this.targetLangSelector.options);
|
||||
for (const option of options) {
|
||||
if (option.value !== this.sourceLangSelector.value) {
|
||||
this.targetLangSelector.value = option.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 交换源语言和目标语言
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {useConfigStore} from '@/stores/configStore';
|
||||
import {useTabStore} from '@/stores/tabStore';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import {computed, onUnmounted, ref} from 'vue';
|
||||
import SettingSection from '../components/SettingSection.vue';
|
||||
@@ -16,7 +17,7 @@ import {useSystemStore} from "@/stores/systemStore";
|
||||
const {t} = useI18n();
|
||||
const configStore = useConfigStore();
|
||||
const systemStore = useSystemStore();
|
||||
|
||||
const tabStore = useTabStore();
|
||||
// 迁移进度状态
|
||||
const migrationProgress = ref<MigrationProgress>(new MigrationProgress({
|
||||
status: MigrationStatus.MigrationStatusCompleted,
|
||||
@@ -171,6 +172,21 @@ const enableLoadingAnimation = computed({
|
||||
set: (value: boolean) => configStore.setEnableLoadingAnimation(value)
|
||||
});
|
||||
|
||||
// 计算属性 - 启用标签页
|
||||
const enableTabs = computed({
|
||||
get: () => configStore.config.general.enableTabs,
|
||||
set: async (value: boolean) => {
|
||||
await configStore.setEnableTabs(value);
|
||||
if (value) {
|
||||
// 开启tabs功能时,初始化当前文档到标签页
|
||||
tabStore.initializeTab();
|
||||
} else {
|
||||
// 关闭tabs功能时,清空所有标签页
|
||||
tabStore.clearAllTabs();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 计算属性 - 开机启动
|
||||
const startAtLogin = computed({
|
||||
get: () => configStore.config.general.startAtLogin,
|
||||
@@ -352,6 +368,9 @@ onUnmounted(() => {
|
||||
<SettingItem :title="t('settings.enableLoadingAnimation')">
|
||||
<ToggleSwitch v-model="enableLoadingAnimation"/>
|
||||
</SettingItem>
|
||||
<SettingItem :title="t('settings.enableTabs')">
|
||||
<ToggleSwitch v-model="enableTabs"/>
|
||||
</SettingItem>
|
||||
</SettingSection>
|
||||
|
||||
<SettingSection :title="t('settings.startup')">
|
||||
@@ -734,4 +753,4 @@ onUnmounted(() => {
|
||||
opacity: 0;
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user