Skip to content

Commit

Permalink
Refactor function names
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Aug 26, 2022
1 parent bf1922a commit c5ba34c
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export default defineComponent({
for (const elementId of this.keybindOnElementIds) {
const element = document.getElementById(elementId)
if (element) {
element.addEventListener('keydown', this.handleShortcut, false)
element.addEventListener('keydown', this.handleSelectionShortcuts, false)
}
}
document.addEventListener('keydown', this.handlePasteShortcut)
document.addEventListener('keydown', this.handleClipboardShortcuts)
const fileListClickedEvent = bus.subscribe('app.files.list.clicked', this.resetSelectionCursor)
const fileListClickedMetaEvent = bus.subscribe(
Expand All @@ -65,10 +65,10 @@ export default defineComponent({
for (const elementId of this.keybindOnElementIds) {
const element = document.getElementById(elementId)
if (element) {
element.removeEventListener('keydown', this.handleShortcut)
element.removeEventListener('keydown', this.handleSelectionShortcuts)
}
}
document.removeEventListener('keydown', this.handlePasteShortcut)
document.removeEventListener('keydown', this.handleClipboardShortcuts)
})
},
Expand All @@ -88,15 +88,15 @@ export default defineComponent({
addFileSelection: 'ADD_FILE_SELECTION'
}),
handleShortcut(event) {
handleSelectionShortcuts(event) {
const key = event.keyCode || event.which
const ctrl = window.navigator.platform.match('Mac') ? event.metaKey : event.ctrlKey
const shift = event.shiftKey
this.handleFileSelectionShortcuts(key, shift, ctrl, event)
},
handlePasteShortcut(event) {
handleClipboardShortcuts(event) {
const key = event.keyCode || event.which
const ctrl = window.navigator.platform.match('Mac') ? event.metaKey : event.ctrlKey
const isCopyAction = key === 67
Expand Down

0 comments on commit c5ba34c

Please sign in to comment.