diff --git a/navigator/src/views/Browser.vue b/navigator/src/views/Browser.vue index 9394268..4080c87 100644 --- a/navigator/src/views/Browser.vue +++ b/navigator/src/views/Browser.vue @@ -3,7 +3,7 @@
-
+
+ + What would you like to do with this file? + + @@ -97,6 +111,7 @@ import PathBreadCrumbs from '../components/PathBreadCrumbs.vue'; import { notificationsInjectionKey, pathHistoryInjectionKey, lastPathStorageKey, settingsInjectionKey } from '../keys'; import { ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, RefreshIcon, ChevronDownIcon, SearchIcon, SunIcon, MoonIcon, EyeIcon, EyeOffIcon, ViewListIcon, ViewGridIcon } from '@heroicons/vue/solid'; import IconToggle from '../components/IconToggle.vue'; +import ModalPopup from '../components/ModalPopup.vue'; const encodePartial = (string) => encodeURIComponent(string) @@ -145,6 +160,20 @@ export default { forwardHistoryDropdown.showDropdown = false; } }); + const openPrompt = reactive({ + show: false, + entry: null, + resetTimeoutHandle: null, + open: (entry) => { + clearTimeout(openPrompt.resetTimeoutHandle); + openPrompt.entry = entry; + openPrompt.show = true; + }, + close: () => { + openPrompt.show = false; + openPrompt.resetTimeoutHandle = setTimeout(() => openPrompt.resetTimeoutHandle = openPrompt.entry = null, 500); + }, + }); const cd = ({ path, host }) => { const newHost = host ?? (pathHistory.current().host); @@ -172,6 +201,23 @@ export default { const getSelected = () => directoryViewRef.value?.getSelected?.() ?? []; + const handleEntryAction = (action, entry) => { + switch (action) { + case 'cd': + cd({path: entry.path}); + break; + case 'edit': + openEditor({path: entry.path}) + break; + case 'openPrompt': + openPrompt.open(entry); + break; + default: + console.error('Unknown entryAction:', action, entry); + break; + } + } + watch(searchFilterStr, () => { searchFilterRegExp.value = new RegExp( `^${searchFilterStr.value @@ -203,12 +249,14 @@ export default { searchFilterRegExp, backHistoryDropdown, forwardHistoryDropdown, + openPrompt, cd, back, forward, up, openEditor, getSelected, + handleEntryAction, } }, components: { @@ -227,9 +275,7 @@ export default { EyeOffIcon, ViewListIcon, ViewGridIcon, + ModalPopup, }, - emits: [ - 'updateFooterText' - ], }