Fix bug: Don't call handleKeyEvent with undefined event

Ace triggers key handlers for both keydown (onCommandKey) and input
(onTextInput) events. Input events don't pass the event, which was
blowing up the keymap.
This commit is contained in:
Nathan Sobo
2012-01-10 19:16:46 -08:00
committed by Corey Johnson & Nathan Sobo
parent 66707fc423
commit 783e9446e9
2 changed files with 47 additions and 33 deletions

View File

@@ -35,10 +35,9 @@ class Editor extends Template
buildAceEditor: ->
@aceEditor = ace.edit this[0]
@aceEditor.setTheme(require "ace/theme/twilight")
@aceEditor.setKeyboardHandler
handleKeyboard: (data, hashId, keyString, keyCode, e) =>
if @keyEventHandler?.handleKeyEvent(e)
handleKeyboard: (data, hashId, keyString, keyCode, event) =>
if event and @keyEventHandler?.handleKeyEvent(event)
{command: {exec: ->}}
else
null