move key binding system into ace from gcli
This commit is contained in:
parent
b6e3f52faf
commit
4fc695fb67
4 changed files with 182 additions and 125 deletions
19
demo/demo.js
19
demo/demo.js
|
|
@ -36,9 +36,11 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
|
||||
var keybinding = require('ace/keyboard/keybinding');
|
||||
|
||||
exports.launch = function(env) {
|
||||
var canon = require("cockpit/canon");
|
||||
var event = require("pilot/event");
|
||||
|
|
@ -395,38 +397,29 @@ exports.launch = function(env) {
|
|||
// Command to focus the command line from the editor.
|
||||
canon.addCommand({
|
||||
name: "focuscli",
|
||||
bindKey: {
|
||||
win: "Ctrl-J",
|
||||
mac: "Command-J"
|
||||
},
|
||||
exec: function() {
|
||||
env.cli.cliView.element.focus();
|
||||
}
|
||||
});
|
||||
keybinding.bindCommand({ win: "Ctrl-J", mac: "Command-J" }, "focuscli");
|
||||
|
||||
// Command to focus the editor line from the command line.
|
||||
canon.addCommand({
|
||||
name: "focuseditor",
|
||||
bindKey: {
|
||||
win: "Ctrl-J",
|
||||
mac: "Command-J"
|
||||
},
|
||||
exec: function() {
|
||||
env.editor.focus();
|
||||
}
|
||||
});
|
||||
keybinding.bindCommand({ win: "Ctrl-J", mac: "Command-J" }, "focuseditor");
|
||||
|
||||
// Fake-Save, works from the editor and the command line.
|
||||
canon.addCommand({
|
||||
name: "save",
|
||||
bindKey: {
|
||||
win: "Ctrl-S",
|
||||
mac: "Command-S"
|
||||
},
|
||||
exec: function() {
|
||||
alert("Fake Save File");
|
||||
}
|
||||
});
|
||||
keybinding.bindCommand({ win: "Ctrl-S", mac: "Command-S" }, "save");
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue