Small fixes in keybinding.js

This commit is contained in:
Sergi Mansilla 2011-11-30 17:42:38 +01:00
commit e944fdde3b

View file

@ -39,7 +39,6 @@
define(function(require, exports, module) {
var useragent = require("../lib/useragent");
var keyUtil = require("../lib/keys");
var event = require("../lib/event");
require("../commands/default_commands");
@ -76,8 +75,9 @@ var KeyBinding = function(editor) {
};
this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
var toExecute;
for (var i = this.$handlers.length; i--;) {
var toExecute = this.$handlers[i].handleKeyboard(
toExecute = this.$handlers[i].handleKeyboard(
this.$data, hashId, keyString, keyCode, e
);
if (toExecute && toExecute.command)
@ -86,7 +86,9 @@ var KeyBinding = function(editor) {
if (!toExecute || !toExecute.command)
return false;
var success = false, commands = this.$editor.commands;
var success = false;
var commands = this.$editor.commands;
// allow keyboardHandler to consume keys
if (toExecute.command != "null")
@ -97,13 +99,13 @@ var KeyBinding = function(editor) {
if (success && e)
event.stopEvent(e);
return success
return success;
};
this.handleKeyboard = function(data, hashId, keyString) {
return {
command: this.$editor.commands.findKeyCommand(hashId, keyString)
}
};
};
this.onCommandKey = function(e, hashId, keyCode) {