update
This commit is contained in:
@@ -76,6 +76,14 @@ const handleCommandInputKeydown = (event: KeyboardEvent) => {
|
||||
}
|
||||
};
|
||||
|
||||
// +++ 监听 Store 中的触发器以激活终端搜索 +++
|
||||
watch(() => focusSwitcherStore.activateTerminalSearchTrigger, () => {
|
||||
if (focusSwitcherStore.activateTerminalSearchTrigger > 0 && !isSearching.value) {
|
||||
console.log('[CommandInputBar] Received terminal search activation trigger from store.');
|
||||
toggleSearch(); // 调用组件内部的切换搜索方法来激活
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -8,8 +8,9 @@ import { createSftpActionsManager, type WebSocketDependencies } from '../composa
|
||||
import { useFileUploader } from '../composables/useFileUploader';
|
||||
// import { useFileEditor } from '../composables/useFileEditor'; // 移除旧的 composable 导入
|
||||
import { useFileEditorStore, type FileInfo } from '../stores/fileEditor.store'; // 导入新的 Store 和 FileInfo 类型
|
||||
import { useSessionStore } from '../stores/session.store'; // 导入 Session Store
|
||||
import { useSettingsStore } from '../stores/settings.store'; // 导入 Settings Store
|
||||
import { useSessionStore } from '../stores/session.store';
|
||||
import { useSettingsStore } from '../stores/settings.store';
|
||||
import { useFocusSwitcherStore } from '../stores/focusSwitcher.store'; // +++ 导入焦点切换 Store +++
|
||||
// WebSocket composable 不再直接使用
|
||||
import FileUploadPopup from './FileUploadPopup.vue';
|
||||
// import FileEditorOverlay from './FileEditorOverlay.vue'; // 不再在此处渲染
|
||||
@@ -88,8 +89,9 @@ const {
|
||||
|
||||
// 实例化 Stores
|
||||
const fileEditorStore = useFileEditorStore(); // 用于共享模式
|
||||
const sessionStore = useSessionStore(); // 用于独立模式
|
||||
const settingsStore = useSettingsStore(); // 用于获取设置
|
||||
const sessionStore = useSessionStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
const focusSwitcherStore = useFocusSwitcherStore(); // +++ 实例化焦点切换 Store +++
|
||||
|
||||
// 从 Settings Store 获取共享设置
|
||||
const { shareFileEditorTabsBoolean } = storeToRefs(settingsStore); // 使用 storeToRefs 保持响应性
|
||||
@@ -980,6 +982,15 @@ watchEffect((onCleanup) => {
|
||||
}
|
||||
});
|
||||
|
||||
// +++ 监听 Store 中的触发器以激活搜索 +++
|
||||
watch(() => focusSwitcherStore.activateFileManagerSearchTrigger, () => {
|
||||
// 确保只在触发器值大于 0 时执行(避免初始加载时触发)
|
||||
if (focusSwitcherStore.activateFileManagerSearchTrigger > 0) {
|
||||
console.log('[FileManager] Received search activation trigger from store.');
|
||||
activateSearch(); // 调用组件内部的激活搜索方法
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
console.log(`[FileManager ${props.sessionId}] 组件即将卸载。`);
|
||||
|
||||
@@ -34,15 +34,22 @@ const dialogStyle = reactive({
|
||||
const hasChanges = ref(false);
|
||||
// 本地副本,用于在弹窗内编辑而不直接修改 store
|
||||
const localSequence: Ref<FocusableInput[]> = ref([]);
|
||||
// +++ 存储原始序列 ID,用于比较 +++
|
||||
const originalSequenceIds: Ref<string[]> = ref([]);
|
||||
|
||||
// --- Watchers ---
|
||||
watch(() => props.isVisible, (newValue) => {
|
||||
if (newValue) {
|
||||
// 从 Store 加载当前配置到本地副本
|
||||
// 使用深拷贝确保 localSequence 是独立的
|
||||
localSequence.value = JSON.parse(JSON.stringify(focusSwitcherStore.getConfiguredInputs));
|
||||
const loadedSequence = focusSwitcherStore.getConfiguredInputs; // 直接获取 getter 的值
|
||||
console.log('[FocusSwitcherConfigurator] Loading sequence from store getter...'); // +++ Log: Start loading +++
|
||||
localSequence.value = JSON.parse(JSON.stringify(loadedSequence));
|
||||
// +++ 存储原始 ID 序列 +++
|
||||
originalSequenceIds.value = loadedSequence.map(item => item.id);
|
||||
hasChanges.value = false;
|
||||
console.log('[FocusSwitcherConfigurator] 弹窗打开, 已加载配置到本地副本:', localSequence.value);
|
||||
console.log('[FocusSwitcherConfigurator] Dialog opened. Loaded sequence to local copy:', localSequence.value); // +++ Log: Loaded local +++
|
||||
console.log('[FocusSwitcherConfigurator] Original sequence IDs stored:', originalSequenceIds.value); // +++ Log: Stored original +++
|
||||
// 重置/计算初始位置和大小
|
||||
requestAnimationFrame(() => {
|
||||
if (dialogRef.value) {
|
||||
@@ -62,16 +69,20 @@ watch(() => props.isVisible, (newValue) => {
|
||||
});
|
||||
|
||||
// 监听本地序列变化,标记未保存更改
|
||||
watch(localSequence, (newValue, oldValue) => {
|
||||
// 确保不是初始化加载触发的 watch
|
||||
if (oldValue.length > 0 || (oldValue.length === 0 && newValue.length > 0)) {
|
||||
// 比较 ID 序列是否真的改变了
|
||||
const oldIds = oldValue.map(item => item.id);
|
||||
const newIds = newValue.map(item => item.id);
|
||||
if (JSON.stringify(oldIds) !== JSON.stringify(newIds)) {
|
||||
hasChanges.value = true;
|
||||
console.log('[FocusSwitcherConfigurator] 本地序列已更改。');
|
||||
}
|
||||
watch(localSequence, (currentLocalSequence) => {
|
||||
// 直接比较当前本地序列的 ID 和原始 ID 序列
|
||||
const currentIds = currentLocalSequence.map(item => item.id);
|
||||
const originalIds = originalSequenceIds.value;
|
||||
|
||||
// 比较 JSON 字符串看是否有变化
|
||||
const hasChanged = JSON.stringify(currentIds) !== JSON.stringify(originalIds); // +++ Calculate change status +++
|
||||
if (hasChanged) {
|
||||
// console.log('[FocusSwitcherConfigurator] Local sequence changed.'); // +++ Log: Changed +++
|
||||
hasChanges.value = true;
|
||||
} else {
|
||||
// console.log('[FocusSwitcherConfigurator] Local sequence reverted to original.'); // +++ Log: Reverted +++
|
||||
// 如果序列变回和原来一样,则标记为无更改
|
||||
hasChanges.value = false;
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
@@ -90,9 +101,10 @@ const closeDialog = () => {
|
||||
const saveConfiguration = () => {
|
||||
// 从本地副本提取 ID 序列
|
||||
const newSequenceIds = localSequence.value.map(item => item.id);
|
||||
console.log('[FocusSwitcherConfigurator] Saving configuration. Sequence IDs to save:', newSequenceIds); // +++ Log: Saving IDs +++
|
||||
focusSwitcherStore.updateSequence(newSequenceIds); // 更新 Store 中的序列
|
||||
focusSwitcherStore.saveConfiguration(); // 持久化保存
|
||||
console.log('[FocusSwitcherConfigurator] 配置已保存:', newSequenceIds);
|
||||
console.log('[FocusSwitcherConfigurator] Configuration save process completed.'); // +++ Log: Save completed +++
|
||||
hasChanges.value = false;
|
||||
emit('close'); // 保存后关闭
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user