From 8dfa82267939fadbaeac57443cd5a8281e902ea4 Mon Sep 17 00:00:00 2001 From: Baobhan Sith <80159437+Heavrnl@users.noreply.github.com> Date: Mon, 5 May 2025 09:57:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=B1=E4=BA=AB=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E9=A1=B5=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=96=87=E4=BB=B6=E4=BE=BF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=9A=E6=98=BE=E7=A4=BA=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 防止多文件状态下混淆文件所属的会话 --- .../src/components/FileEditorContainer.vue | 14 +++++++++++++- .../frontend/src/components/FileEditorOverlay.vue | 9 ++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/components/FileEditorContainer.vue b/packages/frontend/src/components/FileEditorContainer.vue index d298078..da04d63 100644 --- a/packages/frontend/src/components/FileEditorContainer.vue +++ b/packages/frontend/src/components/FileEditorContainer.vue @@ -7,9 +7,15 @@ import FileEditorTabs from './FileEditorTabs.vue'; // 导入标签栏组件 (路 // import { useFileEditorStore } from '../stores/fileEditor.store'; // 移除 Store 导入 import type { FileTab } from '../stores/fileEditor.store'; // 保留类型导入 import { useFocusSwitcherStore } from '../stores/focusSwitcher.store'; // +++ 导入焦点切换 Store +++ +import { useSessionStore } from '../stores/session.store'; // +++ 导入会话 Store +++ +import { useSettingsStore } from '../stores/settings.store'; // +++ 导入设置 Store +++ +import { storeToRefs } from 'pinia'; // +++ 导入 storeToRefs +++ const { t } = useI18n(); const focusSwitcherStore = useFocusSwitcherStore(); // +++ 实例化焦点切换 Store +++ +const sessionStore = useSessionStore(); // +++ 实例化会话 Store +++ +const settingsStore = useSettingsStore(); // +++ 实例化设置 Store +++ +const { shareFileEditorTabsBoolean } = storeToRefs(settingsStore); // +++ 获取共享设置 +++ // --- Props --- const props = defineProps({ @@ -125,6 +131,12 @@ const currentTabFilePath = computed(() => activeTab.value?.filePath ?? ''); const currentTabIsModified = computed(() => activeTab.value?.isModified ?? false); // 用于显示修改状态 // +++ 新增:计算当前选择的编码 +++ const currentSelectedEncoding = computed(() => activeTab.value?.selectedEncoding ?? 'utf-8'); +// +++ 新增:计算当前活动标签的会话名称 +++ +const currentTabSessionName = computed(() => { + const sessionId = activeTab.value?.sessionId; + if (!sessionId) return null; + return sessionStore.sessions.get(sessionId)?.connectionName ?? null; // 修正:使用 connectionName +}); // Watch for changes in the selected encoding to update width watch(currentSelectedEncoding, () => { @@ -291,7 +303,7 @@ const handleKeyDown = (event: KeyboardEvent) => {