From 75e41746e65139141b05112793cfcbe9e96c8e5e Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 30 Jan 2014 20:49:38 +0400 Subject: [PATCH] alllow functions as argument to addKeyboardHandler --- lib/ace/keyboard/keybinding.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ace/keyboard/keybinding.js b/lib/ace/keyboard/keybinding.js index 2a1a2230..d5edd4f8 100644 --- a/lib/ace/keyboard/keybinding.js +++ b/lib/ace/keyboard/keybinding.js @@ -36,7 +36,7 @@ var event = require("../lib/event"); var KeyBinding = function(editor) { this.$editor = editor; - this.$data = { }; + this.$data = {}; this.$handlers = []; this.setDefaultHandler(editor.commands); }; @@ -63,6 +63,8 @@ var KeyBinding = function(editor) { this.addKeyboardHandler = function(kb, pos) { if (!kb) return; + if (typeof kb == "function" && !kb.handleKeyboard) + kb.handleKeyboard = kb; var i = this.$handlers.indexOf(kb); if (i != -1) this.$handlers.splice(i, 1);