Skip to content

Commit

Permalink
Merge pull request #1330 from nextcloud/enh/noid/editing-shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Aug 17, 2022
2 parents d2187d1 + eb2c6be commit 462c723
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,14 @@ export default {
subscribe('files:sidebar:closed', this.handleAppSidebarClose)
window.addEventListener('keydown', this.keyboardDeleteFile)
window.addEventListener('keydown', this.keyboardDownloadFile)
window.addEventListener('keydown', this.keyboardEditFile)
},
beforeDestroy() {
window.removeEventListener('resize', this.onResize)
window.removeEventListener('keydown', this.keyboardDeleteFile)
window.removeEventListener('keydown', this.keyboardDownloadFile)
window.removeEventListener('keydown', this.keyboardEditFile)
},
destroyed() {
Expand Down Expand Up @@ -696,6 +698,15 @@ export default {
}
},
keyboardEditFile(event) {
if (event.key === 'e' && event.ctrlKey === true) {
event.preventDefault()
if (this.canEdit) {
this.onEdit()
}
}
},
cleanup() {
// reset all properties
this.currentFile = {}
Expand Down

0 comments on commit 462c723

Please sign in to comment.