feat: 添加"弹出文件管理器窗口"设置项

This commit is contained in:
Baobhan Sith
2025-05-13 08:47:42 +08:00
parent 83e3d8e043
commit e886d13ed3
10 changed files with 133 additions and 5 deletions
@@ -25,7 +25,7 @@ const commandHistoryStore = useCommandHistoryStore();
const sessionStore = useSessionStore(); // +++ 初始化 Session Store +++
// Get reactive setting from store
const { commandInputSyncTarget } = storeToRefs(settingsStore);
const { commandInputSyncTarget, showPopupFileManagerBoolean } = storeToRefs(settingsStore); // +++ Import showPopupFileManagerBoolean +++
// Get reactive state and actions from quick commands store
const { selectedIndex: quickCommandsSelectedIndex, flatVisibleCommands: quickCommandsFiltered } = storeToRefs(quickCommandsStore);
const { resetSelection: resetQuickCommandsSelection } = quickCommandsStore;
@@ -298,6 +298,17 @@ const closeSuspendedSshSessionsModal = () => {
showSuspendedSshSessionsModal.value = false;
};
// +++ Function to request opening the file manager modal via event bus +++
const openFileManagerModal = () => {
if (activeSessionId.value) {
console.log(`[CommandInputBar] Emitting fileManager:openModalRequest for session: ${activeSessionId.value}`);
emitWorkspaceEvent('fileManager:openModalRequest', { sessionId: activeSessionId.value });
} else {
console.warn('[CommandInputBar] Cannot open file manager 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}`);
@@ -400,6 +411,15 @@ const handleQuickCommandExecute = (command: string) => {
<i v-if="!isSearching" class="fas fa-search text-base"></i>
<i v-else class="fas fa-times text-base"></i>
</button>
<!-- File Manager Button -->
<button
v-if="showPopupFileManagerBoolean"
@click="openFileManagerModal"
class="flex-shrink-0 flex items-center justify-center w-8 h-8 border border-border/50 rounded-lg text-text-secondary transition-colors duration-200 hover:bg-border hover:text-foreground"
:title="t('fileManager.title', '文件管理器')"
>
<i class="fas fa-folder text-base"></i>
</button>
<!-- Search navigation buttons (Hide on mobile when searching) -->
<template v-if="isSearching && !props.isMobile"> <!-- +++ Add !props.isMobile condition +++ -->
@@ -434,6 +454,7 @@ const handleQuickCommandExecute = (command: string) => {
:is-visible="showSuspendedSshSessionsModal"
@close="closeSuspendedSshSessionsModal"
/>
<!-- File Manager Modal is now handled by a listener for 'fileManager:openModalRequest' event -->
</template>
<style scoped>
@@ -21,6 +21,26 @@
</form>
</div>
<hr class="border-border/50">
<!-- Popup File Manager -->
<div class="settings-section-content">
<h3 class="text-base font-semibold text-foreground mb-3">{{ t('settings.popupFileManager.title') }}</h3>
<form @submit.prevent="handleUpdateShowPopupFileManager" class="space-y-4">
<div class="flex items-center">
<input type="checkbox" id="showPopupFileManager" v-model="showPopupFileManagerLocal"
class="h-4 w-4 rounded border-border text-primary focus:ring-primary mr-2 cursor-pointer">
<label for="showPopupFileManager" class="text-sm text-foreground cursor-pointer select-none">{{ t('settings.popupFileManager.enableLabel') }}</label>
</div>
<small class="block mt-1 text-xs text-text-secondary">{{ t('settings.popupFileManager.description') }}</small>
<div class="flex items-center justify-between">
<button type="submit"
class="px-4 py-2 bg-button text-button-text rounded-md shadow-sm hover:bg-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out text-sm font-medium">
{{ t('common.save') }}
</button>
<p v-if="showPopupFileManagerMessage" :class="['text-sm', showPopupFileManagerSuccess ? 'text-success' : 'text-error']">{{ showPopupFileManagerMessage }}</p>
</div>
</form>
</div>
<hr class="border-border/50">
<!-- Share Tabs -->
<div class="settings-section-content">
<h3 class="text-base font-semibold text-foreground mb-3">{{ $t('settings.shareEditorTabs.title') }}</h3>
@@ -268,6 +288,12 @@ const {
terminalEnableRightClickPasteMessage, // NEW
terminalEnableRightClickPasteSuccess, // NEW
handleUpdateTerminalRightClickPasteSetting, // NEW
// Popup File Manager
showPopupFileManagerLocal,
// showPopupFileManagerLoading, // Not used
showPopupFileManagerMessage,
showPopupFileManagerSuccess,
handleUpdateShowPopupFileManager,
} = useWorkspaceSettings();
</script>