Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
move key binding system into ace from gcli
Browse files Browse the repository at this point in the history
  • Loading branch information
joewalker committed Apr 6, 2011
1 parent b6e3f52 commit 4fc695f
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 112 deletions.
19 changes: 6 additions & 13 deletions demo/demo.js
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
};

});

0 comments on commit 4fc695f

Please sign in to comment.