diff --git a/packages/frontend/src/components/CommandInputBar.vue b/packages/frontend/src/components/CommandInputBar.vue index 1e71de0..900f68d 100644 --- a/packages/frontend/src/components/CommandInputBar.vue +++ b/packages/frontend/src/components/CommandInputBar.vue @@ -9,7 +9,8 @@ import { useQuickCommandsStore } from '../stores/quickCommands.store'; import { useCommandHistoryStore } from '../stores/commandHistory.store'; import QuickCommandsModal from './QuickCommandsModal.vue'; // +++ Import the modal component +++ import SuspendedSshSessionsModal from './SuspendedSshSessionsModal.vue'; // +++ Import the new modal +++ -import { useWorkspaceEventEmitter } from '../composables/workspaceEvents'; +import { useFileEditorStore } from '../stores/fileEditor.store'; // +++ Import File Editor Store +++ +import { useWorkspaceEventEmitter } from '../composables/workspaceEvents'; // Disable attribute inheritance as this component has multiple root nodes (div + modal) defineOptions({ inheritAttrs: false }); @@ -23,9 +24,10 @@ const settingsStore = useSettingsStore(); const quickCommandsStore = useQuickCommandsStore(); const commandHistoryStore = useCommandHistoryStore(); const sessionStore = useSessionStore(); // +++ 初始化 Session Store +++ +const fileEditorStore = useFileEditorStore(); // +++ Initialize File Editor Store +++ // Get reactive setting from store -const { commandInputSyncTarget, showPopupFileManagerBoolean } = storeToRefs(settingsStore); // +++ Import showPopupFileManagerBoolean +++ +const { commandInputSyncTarget, showPopupFileManagerBoolean, showPopupFileEditorBoolean } = storeToRefs(settingsStore); // +++ Import showPopupFileEditorBoolean +++ // Get reactive state and actions from quick commands store const { selectedIndex: quickCommandsSelectedIndex, flatVisibleCommands: quickCommandsFiltered } = storeToRefs(quickCommandsStore); const { resetSelection: resetQuickCommandsSelection } = quickCommandsStore; @@ -309,6 +311,17 @@ const openFileManagerModal = () => { } }; +// +++ Function to request opening the file editor modal +++ +const openFileEditorModal = () => { + if (activeSessionId.value) { + console.log(`[CommandInputBar] Triggering popup editor for session: ${activeSessionId.value}`); + fileEditorStore.triggerPopup('', activeSessionId.value); // Call store action directly + } else { + console.warn('[CommandInputBar] Cannot open file editor modal: No active session ID.'); + // Optionally, show a notification to the user + } +}; + // +++ Handler for command execution from the modal +++ const handleQuickCommandExecute = (command: string) => { console.log(`[CommandInputBar] Executing quick command: ${command}`); @@ -420,6 +433,15 @@ const handleQuickCommandExecute = (command: string) => { > + +