Merge remote branch 'upstream/master' into vice
This commit is contained in:
commit
28a46eb83c
7 changed files with 159 additions and 114 deletions
|
|
@ -91,11 +91,12 @@ copy({
|
||||||
{
|
{
|
||||||
root: aceHome + '/lib',
|
root: aceHome + '/lib',
|
||||||
include: /.*\.js$/,
|
include: /.*\.js$/,
|
||||||
exclude: /tests?\/|theme\/|mode\//
|
exclude: /tests?\/|theme\/|mode\/|ace\/worker\/host\.js/
|
||||||
},
|
},
|
||||||
{ base: aceHome + '/lib/', path: 'ace/theme/textmate.js' },
|
{ base: aceHome + '/lib/', path: 'ace/theme/textmate.js' },
|
||||||
{ base: aceHome + '/lib/', path: 'ace/mode/text.js' },
|
{ base: aceHome + '/lib/', path: 'ace/mode/text.js' },
|
||||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript.js' },
|
{ base: aceHome + '/lib/', path: 'ace/mode/javascript.js' },
|
||||||
|
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_worker.js' },
|
||||||
{ base: aceHome + '/lib/', path: 'ace/mode/text_highlight_rules.js' },
|
{ base: aceHome + '/lib/', path: 'ace/mode/text_highlight_rules.js' },
|
||||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' },
|
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' },
|
||||||
{ base: aceHome + '/lib/', path: 'ace/mode/doc_comment_highlight_rules.js' },
|
{ base: aceHome + '/lib/', path: 'ace/mode/doc_comment_highlight_rules.js' },
|
||||||
|
|
@ -121,7 +122,6 @@ copy({
|
||||||
source: [
|
source: [
|
||||||
'build_support/mini_require.js',
|
'build_support/mini_require.js',
|
||||||
pilot,
|
pilot,
|
||||||
// cockpit,
|
|
||||||
ace,
|
ace,
|
||||||
'build_support/boot.js'
|
'build_support/boot.js'
|
||||||
],
|
],
|
||||||
|
|
@ -146,7 +146,14 @@ copy({
|
||||||
dest: 'build/ace-uncompressed.js'
|
dest: 'build/ace-uncompressed.js'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create worker bootstrap code
|
||||||
|
copy({
|
||||||
|
source: "lib/ace/worker/host.js",
|
||||||
|
filter: [function(data) {
|
||||||
|
return data + "\nimportScripts('ace-uncompressed.js')";
|
||||||
|
}],
|
||||||
|
dest: 'build/host.js'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -263,7 +270,7 @@ function runFilters(value, filter, reading, name) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.onRead == reading) {
|
if ((!!filter.onRead) == reading) {
|
||||||
return filter(value, name);
|
return filter(value, name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -35,41 +35,45 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
var deps = [ "pilot/fixoldbrowsers", "pilot/plugin_manager", "pilot/settings",
|
// don't define it in a worker.
|
||||||
"pilot/environment" ];
|
if (window.document) {
|
||||||
|
|
||||||
require(deps, function() {
|
var deps = [ "pilot/fixoldbrowsers", "pilot/plugin_manager", "pilot/settings",
|
||||||
var catalog = require("pilot/plugin_manager").catalog;
|
"pilot/environment" ];
|
||||||
catalog.registerPlugins([ "pilot/index" ]);
|
|
||||||
});
|
|
||||||
|
|
||||||
var ace = {
|
require(deps, function() {
|
||||||
edit: function(el) {
|
|
||||||
if (typeof(el) == "string") {
|
|
||||||
el = document.getElementById(el);
|
|
||||||
}
|
|
||||||
var env = require("pilot/environment").create();
|
|
||||||
var catalog = require("pilot/plugin_manager").catalog;
|
var catalog = require("pilot/plugin_manager").catalog;
|
||||||
catalog.startupPlugins({ env: env }).then(function() {
|
catalog.registerPlugins([ "pilot/index" ]);
|
||||||
var EditSession = require("ace/edit_session").EditSession;
|
});
|
||||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
|
||||||
var UndoManager = require("ace/undomanager").UndoManager;
|
|
||||||
var Editor = require("ace/editor").Editor;
|
|
||||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
|
||||||
var theme = require("ace/theme/textmate");
|
|
||||||
|
|
||||||
var doc = new EditSession(el.innerHTML);
|
var ace = {
|
||||||
el.innerHTML = '';
|
edit: function(el) {
|
||||||
doc.setMode(new JavaScriptMode());
|
if (typeof(el) == "string") {
|
||||||
doc.setUndoManager(new UndoManager());
|
el = document.getElementById(el);
|
||||||
env.document = doc;
|
}
|
||||||
env.editor = new Editor(new Renderer(el, theme));
|
var env = require("pilot/environment").create();
|
||||||
env.editor.setSession(doc);
|
var catalog = require("pilot/plugin_manager").catalog;
|
||||||
env.editor.resize();
|
catalog.startupPlugins({ env: env }).then(function() {
|
||||||
window.addEventListener("resize", function() {
|
var EditSession = require("ace/edit_session").EditSession;
|
||||||
|
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||||
|
var UndoManager = require("ace/undomanager").UndoManager;
|
||||||
|
var Editor = require("ace/editor").Editor;
|
||||||
|
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||||
|
var theme = require("ace/theme/textmate");
|
||||||
|
|
||||||
|
var doc = new EditSession(el.innerHTML);
|
||||||
|
el.innerHTML = '';
|
||||||
|
doc.setMode(new JavaScriptMode());
|
||||||
|
doc.setUndoManager(new UndoManager());
|
||||||
|
env.document = doc;
|
||||||
|
env.editor = new Editor(new Renderer(el, theme));
|
||||||
|
env.editor.setSession(doc);
|
||||||
env.editor.resize();
|
env.editor.resize();
|
||||||
}, false);
|
window.addEventListener("resize", function() {
|
||||||
el.env = env;
|
env.editor.resize();
|
||||||
});
|
}, false);
|
||||||
}
|
el.env = env;
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -35,59 +35,64 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
function require(module, callback) {
|
// don't define it in a worker. There we have a different implementation
|
||||||
|
if (window.document) {
|
||||||
|
|
||||||
if (Array.isArray(module)) {
|
window.require = function(module, callback) {
|
||||||
var params = [];
|
|
||||||
module.forEach(function(m) {
|
|
||||||
params.push(require._lookup(m));
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
if (callback) {
|
if (Array.isArray(module)) {
|
||||||
callback.apply(null, params);
|
var params = [];
|
||||||
|
module.forEach(function(m) {
|
||||||
|
params.push(require._lookup(m));
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback.apply(null, params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof module === 'string') {
|
||||||
|
payload = require._lookup(module);
|
||||||
|
if (callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
return payload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
require.modules = {};
|
||||||
|
require.packaged = true;
|
||||||
|
|
||||||
if (typeof module === 'string') {
|
require._lookup = function(moduleName) {
|
||||||
payload = require._lookup(module);
|
var payload = require.modules[moduleName];
|
||||||
if (callback) {
|
var module_name = moduleName;
|
||||||
callback();
|
if (payload == null) {
|
||||||
|
console.error('Missing module: ' + moduleName);
|
||||||
|
console.trace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof payload === 'function') {
|
||||||
|
var exports = {};
|
||||||
|
var module = {
|
||||||
|
id: moduleName,
|
||||||
|
uri: ''
|
||||||
|
};
|
||||||
|
payload(require, exports, module);
|
||||||
|
payload = exports;
|
||||||
|
// cache the resulting module object for next time
|
||||||
|
require.modules[module_name] = payload;
|
||||||
|
}
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
|
};
|
||||||
|
|
||||||
|
window.define = function(module, payload) {
|
||||||
|
if (typeof module !== 'string') {
|
||||||
|
console.error('dropping module because define wasn\'t munged.');
|
||||||
|
console.trace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('defining module: ' + module + ' as a ' + typeof payload);
|
||||||
|
require.modules[module] = payload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require.modules = {};
|
|
||||||
|
|
||||||
require._lookup = function(moduleName) {
|
|
||||||
var payload = require.modules[moduleName];
|
|
||||||
var module_name = moduleName;
|
|
||||||
if (payload == null) {
|
|
||||||
console.error('Missing module: ' + moduleName);
|
|
||||||
console.trace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof payload === 'function') {
|
|
||||||
var exports = {};
|
|
||||||
var module = {
|
|
||||||
id: moduleName,
|
|
||||||
uri: ''
|
|
||||||
};
|
|
||||||
payload(require, exports, module);
|
|
||||||
payload = exports;
|
|
||||||
// cache the resulting module object for next time
|
|
||||||
require.modules[module_name] = payload;
|
|
||||||
}
|
|
||||||
|
|
||||||
return payload;
|
|
||||||
};
|
|
||||||
|
|
||||||
function define(module, payload) {
|
|
||||||
if (typeof module !== 'string') {
|
|
||||||
console.error('dropping module because define wasn\'t munged.');
|
|
||||||
console.trace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log('defining module: ' + module + ' as a ' + typeof payload);
|
|
||||||
require.modules[module] = payload;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,13 @@ var Editor =function(renderer, session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.focus = function() {
|
this.focus = function() {
|
||||||
|
// Safari need the timeout
|
||||||
|
// iOS and Firefox need it called immediately
|
||||||
|
// to be on the save side we do both
|
||||||
|
var _self = this;
|
||||||
|
setTimeout(function() {
|
||||||
|
_self.textInput.focus();
|
||||||
|
});
|
||||||
this.textInput.focus();
|
this.textInput.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,33 +7,48 @@ var window = {
|
||||||
console: console
|
console: console
|
||||||
};
|
};
|
||||||
|
|
||||||
var require = function(name) {
|
var require = function(id) {
|
||||||
if (require.modules[name])
|
var module = require.modules[id];
|
||||||
return require.modules[name].exports;
|
if (module) {
|
||||||
|
if (!module.initialized) {
|
||||||
|
module.exports = module.factory().exports;
|
||||||
|
module.initialized = true;
|
||||||
|
}
|
||||||
|
return module.exports;
|
||||||
|
}
|
||||||
|
|
||||||
var chunks = name.split("/");
|
var chunks = id.split("/");
|
||||||
chunks[0] = require.tlns[chunks[0]] || chunks[0];
|
chunks[0] = require.tlns[chunks[0]] || chunks[0];
|
||||||
path = require.baseUrl + "/" + chunks.join("/") + ".js"
|
path = require.baseUrl + "/" + chunks.join("/") + ".js"
|
||||||
|
|
||||||
require.id = name;
|
require.id = id;
|
||||||
importScripts(path);
|
importScripts(path);
|
||||||
return require.modules[name].exports;
|
return require(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
require.modules = {};
|
require.modules = {};
|
||||||
require.tlns = {};
|
require.tlns = {};
|
||||||
require.baseUrl;
|
require.baseUrl;
|
||||||
|
|
||||||
var define = function(factory) {
|
var define = function(id, factory) {
|
||||||
var module = {
|
if (!factory) {
|
||||||
exports: {}
|
factory = id;
|
||||||
|
id = require.id;
|
||||||
|
}
|
||||||
|
if (id.indexOf("text!") == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
require.modules[id] = {
|
||||||
|
factory: function() {
|
||||||
|
var module = {
|
||||||
|
exports: {}
|
||||||
|
};
|
||||||
|
var returnExports = factory(require, module.exports, module);
|
||||||
|
if (returnExports)
|
||||||
|
module.exports = exports;
|
||||||
|
return module;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var name = require.id;
|
|
||||||
var returnExports = factory(require, module.exports, module);
|
|
||||||
if (returnExports)
|
|
||||||
module.exports = exports;
|
|
||||||
|
|
||||||
require.modules[name] = module;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function initBaseUrls(baseUrl, topLevelNamespaces) {
|
function initBaseUrls(baseUrl, topLevelNamespaces) {
|
||||||
|
|
@ -81,6 +96,7 @@ onmessage = function(e) {
|
||||||
main[msg.command].apply(main, msg.args);
|
main[msg.command].apply(main, msg.args);
|
||||||
else if (msg.init) {
|
else if (msg.init) {
|
||||||
initBaseUrls(msg.base, msg.tlns);
|
initBaseUrls(msg.base, msg.tlns);
|
||||||
|
require("pilot/fixoldbrowsers");
|
||||||
sender = initSender();
|
sender = initSender();
|
||||||
var clazz = require(msg.module)[msg.classname];
|
var clazz = require(msg.module)[msg.classname];
|
||||||
main = new clazz(sender);
|
main = new clazz(sender);
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,19 @@ var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||||
var WorkerClient = function(baseUrl, topLevelNamespaces, module, classname) {
|
var WorkerClient = function(baseUrl, topLevelNamespaces, module, classname) {
|
||||||
|
|
||||||
this.callbacks = [];
|
this.callbacks = [];
|
||||||
var workerUrl = require.nameToUrl("ace/worker/host", null, "_");
|
|
||||||
var worker = this.$worker = new Worker(workerUrl);
|
|
||||||
|
|
||||||
var tlns = {};
|
if (require.packaged) {
|
||||||
for (var i=0; i<topLevelNamespaces.length; i++) {
|
var worker = this.$worker = new Worker("host.js");
|
||||||
var ns = topLevelNamespaces[i];
|
}
|
||||||
tlns[ns] = require.nameToUrl(ns, null, "_").replace(/.js$/, "").replace(require.config.baseUrl, "");
|
else {
|
||||||
|
var workerUrl = require.nameToUrl("ace/worker/host", null, "_");
|
||||||
|
var worker = this.$worker = new Worker(workerUrl);
|
||||||
|
|
||||||
|
var tlns = {};
|
||||||
|
for (var i=0; i<topLevelNamespaces.length; i++) {
|
||||||
|
var ns = topLevelNamespaces[i];
|
||||||
|
tlns[ns] = require.nameToUrl(ns, null, "_").replace(/.js$/, "").replace(require.config.baseUrl, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$worker.postMessage({
|
this.$worker.postMessage({
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit dbc78536a4ea61e0f762067fb847213526500d9f
|
Subproject commit 1fa3516d4d553af9f6edd81c20023bcfab08c2a3
|
||||||
Loading…
Add table
Add a link
Reference in a new issue