diff --git a/frontend/src/views/Share.vue b/frontend/src/views/Share.vue index b6d07a5f..6c7b3db9 100644 --- a/frontend/src/views/Share.vue +++ b/frontend/src/views/Share.vue @@ -33,6 +33,12 @@
+
+ +
@@ -42,7 +48,8 @@
{{ item.isDir ? 'folder' : (item.type==='image') ? 'insert_photo' : 'insert_drive_file' }} @@ -79,6 +86,8 @@ export default { notFound: false, file: null, showLimit: 500, + multiple: false, + touches: 0, selected: [], firstSelected: -1 }), @@ -88,6 +97,12 @@ export default { created: function () { this.fetchData() }, + mounted () { + window.addEventListener('keydown', this.keyEvent) + }, + beforeDestroy () { + window.removeEventListener('keydown', this.keyEvent) + }, computed: { hasSelected: function () { return this.selected.length > 0 @@ -163,6 +178,8 @@ export default { fetchData: async function () { this.loaded = false this.notFound = false + this.multiple = false + this.touches = 0 this.selected = [] this.firstSelected = -1 try { @@ -216,12 +233,32 @@ export default { return } - if (!event.ctrlKey && !this.hasSelected) this.resetSelected() + if (!event.ctrlKey && !event.metaKey && !this.multiple) this.resetSelected() if (this.firstSelected === -1) this.firstSelected = index this.addSelected(name) }, - dbclick: function (name) { + dblclick: function (name) { this.$router.push({path: `/share/${this.hash}${name}`}) + }, + touchstart (name) { + setTimeout(() => { + this.touches = 0 + }, 300) + + this.touches++ + if (this.touches > 1) { + this.dblclick(name) + } + }, + keyEvent (event) { + // Esc! + if (event.keyCode === 27) { + // If we're on a listing, unselect all + // files and folders. + if (this.hasSelected) { + this.resetSelected() + } + } } } }