Pass originalEvent property on command events

vim-mode needs access to the original keystroke that triggered the
event.
This commit is contained in:
Matt Colyer
2013-11-21 17:49:07 -05:00
parent 66171e0301
commit 6c1b63d352

View File

@@ -159,15 +159,16 @@ class Keymap
else
if keyBinding.command is 'native!'
shouldBubble = true
else if @triggerCommandEvent(element, keyBinding.command)
else if @triggerCommandEvent(element, keyBinding.command, event)
shouldBubble = false
break if shouldBubble?
shouldBubble ? true
triggerCommandEvent: (element, commandName) ->
triggerCommandEvent: (element, commandName, event) ->
commandEvent = $.Event(commandName)
commandEvent.originalEvent = event
commandEvent.abortKeyBinding = -> commandEvent.stopImmediatePropagation()
$(element).trigger(commandEvent)
not commandEvent.isImmediatePropagationStopped()