Skip to content

Commit 6c6ce24

Browse files
committed
Capture keydown instead of keypress. [Fixes Chrome shortcut]
1 parent 6074e4a commit 6c6ce24

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/assets/javascripts/commandz.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ class CommandZ
2020

2121
keyboardShortcuts: (enable=true) ->
2222
addOrRemove = if enable then 'addEventListener' else 'removeEventListener'
23-
document[addOrRemove]('keypress', this.handleKeypress)
23+
document[addOrRemove]('keydown', this.handleKeypress)
2424

2525
handleKeypress: (e) =>
2626
return if document.activeElement.nodeName is 'INPUT'
27-
return unless (e.which is 122 and e.metaKey is true || e.which is 26 and e.ctrlKey is true)
27+
return unless (e.which is 90 and e.metaKey is true || e.which is 26 and e.ctrlKey is true)
2828

2929
e.preventDefault()
3030
if e.shiftKey then this.redo() else this.undo()

0 commit comments

Comments
 (0)