Small fixes in keybinding.js
This commit is contained in:
parent
d3013ad835
commit
e944fdde3b
1 changed files with 7 additions and 5 deletions
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
var useragent = require("../lib/useragent");
|
|
||||||
var keyUtil = require("../lib/keys");
|
var keyUtil = require("../lib/keys");
|
||||||
var event = require("../lib/event");
|
var event = require("../lib/event");
|
||||||
require("../commands/default_commands");
|
require("../commands/default_commands");
|
||||||
|
|
@ -76,8 +75,9 @@ var KeyBinding = function(editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
|
this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
|
||||||
|
var toExecute;
|
||||||
for (var i = this.$handlers.length; i--;) {
|
for (var i = this.$handlers.length; i--;) {
|
||||||
var toExecute = this.$handlers[i].handleKeyboard(
|
toExecute = this.$handlers[i].handleKeyboard(
|
||||||
this.$data, hashId, keyString, keyCode, e
|
this.$data, hashId, keyString, keyCode, e
|
||||||
);
|
);
|
||||||
if (toExecute && toExecute.command)
|
if (toExecute && toExecute.command)
|
||||||
|
|
@ -86,7 +86,9 @@ var KeyBinding = function(editor) {
|
||||||
|
|
||||||
if (!toExecute || !toExecute.command)
|
if (!toExecute || !toExecute.command)
|
||||||
return false;
|
return false;
|
||||||
var success = false, commands = this.$editor.commands;
|
|
||||||
|
var success = false;
|
||||||
|
var commands = this.$editor.commands;
|
||||||
|
|
||||||
// allow keyboardHandler to consume keys
|
// allow keyboardHandler to consume keys
|
||||||
if (toExecute.command != "null")
|
if (toExecute.command != "null")
|
||||||
|
|
@ -97,13 +99,13 @@ var KeyBinding = function(editor) {
|
||||||
if (success && e)
|
if (success && e)
|
||||||
event.stopEvent(e);
|
event.stopEvent(e);
|
||||||
|
|
||||||
return success
|
return success;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleKeyboard = function(data, hashId, keyString) {
|
this.handleKeyboard = function(data, hashId, keyString) {
|
||||||
return {
|
return {
|
||||||
command: this.$editor.commands.findKeyCommand(hashId, keyString)
|
command: this.$editor.commands.findKeyCommand(hashId, keyString)
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onCommandKey = function(e, hashId, keyCode) {
|
this.onCommandKey = function(e, hashId, keyCode) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue