Merge remote-tracking branch 'mozilla/master'
Conflicts: lib/ace/edit_session.js lib/ace/layer/text.js
This commit is contained in:
commit
103255f4d2
34 changed files with 1790 additions and 547 deletions
24
demo/boot.js
24
demo/boot.js
|
|
@ -39,21 +39,29 @@ require({
|
|||
paths: {
|
||||
demo: "../demo",
|
||||
ace: "../lib/ace",
|
||||
cockpit: "../support/cockpit/lib/cockpit",
|
||||
pilot: "../support/pilot/lib/pilot"
|
||||
gcli: "../support/cockpit/lib/gcli",
|
||||
pilot: "../support/cockpit/support/pilot/lib/pilot"
|
||||
}
|
||||
});
|
||||
|
||||
var deps = [ "pilot/fixoldbrowsers", "pilot/plugin_manager", "pilot/settings",
|
||||
"pilot/environment", "demo/demo" ];
|
||||
var deps = [
|
||||
"pilot/fixoldbrowsers",
|
||||
"ace/plugin_manager",
|
||||
"ace/environment",
|
||||
"demo/demo"
|
||||
];
|
||||
|
||||
var plugins = [ "pilot/index", "cockpit/index", "ace/defaults" ];
|
||||
require(deps, function() {
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
var catalog = require("ace/plugin_manager").catalog;
|
||||
|
||||
var plugins = [ "gcli/index", "ace/index" ];
|
||||
catalog.registerPlugins(plugins).then(function() {
|
||||
var env = require("pilot/environment").create();
|
||||
var env = require("ace/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
require("demo/demo").launch(env);
|
||||
|
||||
var gcli = require("gcli/index");
|
||||
gcli.createView({ env: env });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
53
demo/demo.js
53
demo/demo.js
|
|
@ -36,11 +36,13 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
|
||||
var keybinding = require('ace/keyboard/keybinding');
|
||||
|
||||
exports.launch = function(env) {
|
||||
var canon = require("pilot/canon");
|
||||
var gcli = require("gcli/index");
|
||||
var event = require("pilot/event");
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
|
|
@ -77,7 +79,7 @@ exports.launch = function(env) {
|
|||
custom: new HashHandler({
|
||||
"gotoright": "Tab"
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
var docs = {};
|
||||
|
||||
|
|
@ -88,7 +90,7 @@ exports.launch = function(env) {
|
|||
}
|
||||
docs.plain = new EditSession(loreIpsum);
|
||||
docs.plain.setUseWrapMode(true);
|
||||
docs.plain.setWrapLimitRange(80, 80)
|
||||
docs.plain.setWrapLimitRange(80, 80);
|
||||
docs.plain.setMode(new TextMode());
|
||||
docs.plain.setUndoManager(new UndoManager());
|
||||
|
||||
|
|
@ -393,62 +395,31 @@ exports.launch = function(env) {
|
|||
*/
|
||||
|
||||
// Command to focus the command line from the editor.
|
||||
canon.addCommand({
|
||||
gcli.addCommand({
|
||||
name: "focuscli",
|
||||
bindKey: {
|
||||
win: "Ctrl-J",
|
||||
mac: "Command-J",
|
||||
sender: "editor"
|
||||
},
|
||||
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({
|
||||
gcli.addCommand({
|
||||
name: "focuseditor",
|
||||
bindKey: {
|
||||
win: "Ctrl-J",
|
||||
mac: "Command-J",
|
||||
sender: "cli"
|
||||
},
|
||||
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({
|
||||
gcli.addCommand({
|
||||
name: "save",
|
||||
bindKey: {
|
||||
win: "Ctrl-S",
|
||||
mac: "Command-S",
|
||||
sender: "editor|cli"
|
||||
},
|
||||
exec: function() {
|
||||
alert("Fake Save File");
|
||||
}
|
||||
});
|
||||
|
||||
// Fake-Print with custom lookup-sender-match function.
|
||||
canon.addCommand({
|
||||
name: "save",
|
||||
bindKey: {
|
||||
win: "Ctrl-P",
|
||||
mac: "Command-P",
|
||||
sender: function(env, sender, hashId, keyString) {
|
||||
if (sender == "editor") {
|
||||
return true;
|
||||
} else {
|
||||
alert("Sorry, can only print from the editor");
|
||||
}
|
||||
}
|
||||
},
|
||||
exec: function() {
|
||||
alert("Fake Print File");
|
||||
}
|
||||
});
|
||||
keybinding.bindCommand({ win: "Ctrl-S", mac: "Command-S" }, "save");
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ body {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
#cockpitInput {
|
||||
#gcliInput {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
|
|
@ -36,12 +36,11 @@ body {
|
|||
font-size: 120%;
|
||||
}
|
||||
|
||||
#cockpitOutput {
|
||||
padding: 10px;
|
||||
#gcliOutput {
|
||||
margin: 0 15px;
|
||||
border: 1px solid #AAA;
|
||||
-moz-border-radius-topleft: 10px;
|
||||
-moz-border-radius-topright: 10px;
|
||||
border-top-left-radius: 4px; border-top-right-radius: 4px;
|
||||
background: #DDD; color: #000;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue