feat: add key shortcuts

- 'Ctrl + a' selects all files in listing.
- 'Enter' to confirm a prompt.
This commit is contained in:
Ramires Viana committed 2020-06-21 21:54:23 +00:00
1 parent cd454bae51
commit 95316cbe8c
2 files changed
+42 -2

No files matched your search

+14 -1
View File
@@ -190,7 +190,7 @@ export default {
document.removeEventListener('drop', this.drop)
},
methods: {
...mapMutations([ 'updateUser' ]),
...mapMutations([ 'updateUser', 'addSelected' ]),
base64: function (name) {
return window.btoa(unescape(encodeURIComponent(name)))
},
@@ -213,6 +213,19 @@ export default {
case 'v':
this.paste(event)
break
case 'a':
event.preventDefault()
for (let file of this.items.files) {
if (this.$store.state.selected.indexOf(file.index) === -1) {
this.addSelected(file.index)
}
}
for (let dir of this.items.dirs) {
if (this.$store.state.selected.indexOf(dir.index) === -1) {
this.addSelected(dir.index)
}
}
break
}
},
preventDefault (event) {