Added ability to fire Ace commands directly from keys.json, will be useful for Sublime bindings. Fixes #8. Still need to unbind these commands on startup, or they won't take effect.

This commit is contained in:
Thomas Wilburn 2013-09-05 08:24:46 -07:00
parent 218e993298
commit af0e0bb743

View file

@ -14,6 +14,8 @@ define(["settings!keys", "command", "editor", "dom2"], function(Settings, comman
40: "DOWN"
};
//need to remove existing Ace conflicts on init:start
//we have to listen on keydown, because keypress will get caught by the window manager
window.on("keydown", function(e) {
var char = String.fromCharCode(e.keyCode);
@ -34,6 +36,9 @@ define(["settings!keys", "command", "editor", "dom2"], function(Settings, comman
command: action
};
}
if (action.ace) {
return editor.execCommand(action.ace);
}
command.fire(action.command, action.argument);
}
});