Add file context menu (only rename for now).
This commit is contained in:
parent
5dd1bd9bdc
commit
6880f82c19
|
@ -86,6 +86,7 @@ import FileRenameInput from './FileRenameInput.vue'
|
||||||
import { connect, controlUrl } from '@/repositories/WS'
|
import { connect, controlUrl } from '@/repositories/WS'
|
||||||
import { collator, formatSize } from '@/utils'
|
import { collator, formatSize } from '@/utils'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import ContextMenu from '@imengyu/vue3-context-menu'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
path: Array<string>
|
path: Array<string>
|
||||||
|
@ -302,9 +303,13 @@ const allSelected = computed({
|
||||||
|
|
||||||
const loc = computed(() => props.path.join('/'))
|
const loc = computed(() => props.path.join('/'))
|
||||||
|
|
||||||
const contextMenu = (ev: Event, doc: Doc) => {
|
const contextMenu = (ev: MouseEvent, doc: Doc) => {
|
||||||
cursor.value = 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 } },
|
||||||
|
],
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user