From 6880f82c19bc3ddbdab0577241795f7c0dac8254 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Mon, 13 Nov 2023 10:09:12 -0800 Subject: [PATCH] Add file context menu (only rename for now). --- frontend/src/components/FileExplorer.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/FileExplorer.vue b/frontend/src/components/FileExplorer.vue index f873093..f490e4e 100644 --- a/frontend/src/components/FileExplorer.vue +++ b/frontend/src/components/FileExplorer.vue @@ -86,6 +86,7 @@ import FileRenameInput from './FileRenameInput.vue' import { connect, controlUrl } from '@/repositories/WS' import { collator, formatSize } from '@/utils' import { useRouter } from 'vue-router' +import ContextMenu from '@imengyu/vue3-context-menu' const props = defineProps<{ path: Array @@ -302,9 +303,13 @@ const allSelected = computed({ const loc = computed(() => props.path.join('/')) -const contextMenu = (ev: Event, doc: Doc) => { +const contextMenu = (ev: MouseEvent, doc: Doc) => { cursor.value = doc - console.log('Context menu', ev, doc) + ContextMenu.showContextMenu({ + x: ev.x, y: ev.y, items: [ + { label: 'Rename', onClick: () => { editing.value = doc } }, + ], + }) }