mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Editor can have custom key event handler.
editor.keyEventHandler.handleKeyEvent is passed all key events. When it returns true, the event is not handled by Ace.
This commit is contained in:
@@ -12,6 +12,7 @@ class Editor extends Template
|
||||
viewProperties:
|
||||
aceEditor: null
|
||||
buffer: null
|
||||
keyEventHandler: null
|
||||
|
||||
initialize: () ->
|
||||
@aceSessions = {}
|
||||
@@ -34,6 +35,13 @@ class Editor extends Template
|
||||
@aceEditor = ace.edit this[0]
|
||||
@aceEditor.setTheme(require "ace/theme/twilight")
|
||||
|
||||
@aceEditor.setKeyboardHandler
|
||||
handleKeyboard: (data, hashId, keyString, keyCode, e) =>
|
||||
if @keyEventHandler?.handleKeyEvent(e)
|
||||
{command: {exec: ->}}
|
||||
else
|
||||
null
|
||||
|
||||
getAceSession: ->
|
||||
@aceEditor.getSession()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user