Skip to content

Commit 6350de9

Browse files
committed
allow to download files with a shortcut
Signed-off-by: szaimen <[email protected]>
1 parent 3cb712f commit 6350de9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/views/Viewer.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,18 @@ export default {
326326
subscribe('files:sidebar:opened', this.handleAppSidebarOpen)
327327
subscribe('files:sidebar:closed', this.handleAppSidebarClose)
328328
window.addEventListener('keydown', this.keyboardDeleteFile)
329+
window.addEventListener('keydown', this.keyboardDownloadFile)
329330
},
330331
331332
beforeDestroy() {
332333
window.removeEventListener('resize', this.onResize)
333334
window.removeEventListener('keydown', this.keyboardDeleteFile)
335+
window.removeEventListener('keydown', this.keyboardDownloadFile)
334336
},
335337
336338
destroyed() {
337339
// Unsubscribe to Files' Sidebar events.
338340
unsubscribe('files:sidebar:opened', this.handleAppSidebarOpen)
339-
unsubscribe('files:sidebar:closed', this.handleAppSidebarClose)
340341
},
341342
342343
methods: {
@@ -655,6 +656,15 @@ export default {
655656
}
656657
},
657658
659+
keyboardDownloadFile(event) {
660+
if (event.key === 'd' && event.ctrlKey === true) {
661+
event.preventDefault()
662+
if (this.canDownload) {
663+
// TODO (trigger the download, see line 53 and below
664+
}
665+
}
666+
},
667+
658668
cleanup() {
659669
// reset all properties
660670
this.currentFile = {}

0 commit comments

Comments
 (0)