Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow to download files with a shortcut
Browse files Browse the repository at this point in the history
Signed-off-by: szaimen <[email protected]>
szaimen committed Aug 12, 2022
1 parent 3cb712f commit 6350de9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/views/Viewer.vue
Original file line number Diff line number Diff line change
@@ -326,17 +326,18 @@ export default {
subscribe('files:sidebar:opened', this.handleAppSidebarOpen)
subscribe('files:sidebar:closed', this.handleAppSidebarClose)
window.addEventListener('keydown', this.keyboardDeleteFile)
window.addEventListener('keydown', this.keyboardDownloadFile)
},

beforeDestroy() {
window.removeEventListener('resize', this.onResize)
window.removeEventListener('keydown', this.keyboardDeleteFile)
window.removeEventListener('keydown', this.keyboardDownloadFile)
},

destroyed() {
// Unsubscribe to Files' Sidebar events.
unsubscribe('files:sidebar:opened', this.handleAppSidebarOpen)
unsubscribe('files:sidebar:closed', this.handleAppSidebarClose)
},

methods: {
@@ -655,6 +656,15 @@ export default {
}
},

keyboardDownloadFile(event) {
if (event.key === 'd' && event.ctrlKey === true) {
event.preventDefault()
if (this.canDownload) {
// TODO (trigger the download, see line 53 and below
}
}
},

cleanup() {
// reset all properties
this.currentFile = {}

0 comments on commit 6350de9

Please sign in to comment.