|
|
@ -1,5 +1,6 @@
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
|
|
|
|
function loadDevEditor() {
|
|
|
|
self.loadDevEditor = function() {
|
|
|
|
return (getQueryStringValue('editor') === 'dev');
|
|
|
|
return (getQueryStringValue('editor') === 'dev');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -7,33 +8,43 @@ function getQueryStringValue (key) {
|
|
|
|
return unescape(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
|
|
|
|
return unescape(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
function resolveCorePath(core) {
|
|
|
|
// Resolve paths
|
|
|
|
|
|
|
|
// should run the editor and/or plugins from source? (or from the node module)
|
|
|
|
|
|
|
|
if (loadDevEditor()) {
|
|
|
|
if (loadDevEditor()) {
|
|
|
|
METADATA.CORE.path = METADATA.CORE.srcPath;
|
|
|
|
return core.srcPath;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
METADATA.CORE.path = '/monaco-editor/' + METADATA.CORE.path;
|
|
|
|
return '/monaco-editor/' + core.path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
METADATA.PLUGINS.forEach(function(plugin) {
|
|
|
|
}
|
|
|
|
// should run the editor plugins from source? (or from node modules)
|
|
|
|
|
|
|
|
|
|
|
|
function resolvePluginPath(plugin) {
|
|
|
|
if (plugin.srcPath && getQueryStringValue(plugin.name) === 'dev') {
|
|
|
|
if (plugin.srcPath && getQueryStringValue(plugin.name) === 'dev') {
|
|
|
|
plugin.path = plugin.srcPath;
|
|
|
|
return plugin.srcPath;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
plugin.path = '/monaco-editor/' + plugin.path;
|
|
|
|
return '/monaco-editor/' + plugin.path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.RESOLVED_CORE_PATH = resolveCorePath(METADATA.CORE);
|
|
|
|
|
|
|
|
var RESOLVED_PLUGINS = METADATA.PLUGINS.map(function(plugin) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
name: plugin.name,
|
|
|
|
|
|
|
|
contrib: plugin.contrib,
|
|
|
|
|
|
|
|
modulePrefix: plugin.modulePrefix,
|
|
|
|
|
|
|
|
path: resolvePluginPath(plugin)
|
|
|
|
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
self.METADATA = null;
|
|
|
|
|
|
|
|
|
|
|
|
function loadEditor(callback, PATH_PREFIX) {
|
|
|
|
self.loadEditor = function(callback, PATH_PREFIX) {
|
|
|
|
PATH_PREFIX = PATH_PREFIX || '';
|
|
|
|
PATH_PREFIX = PATH_PREFIX || '';
|
|
|
|
var pathsConfig = {};
|
|
|
|
var pathsConfig = {};
|
|
|
|
METADATA.PLUGINS.forEach(function(plugin) {
|
|
|
|
RESOLVED_PLUGINS.forEach(function(plugin) {
|
|
|
|
pathsConfig[plugin.modulePrefix] = PATH_PREFIX + plugin.path;
|
|
|
|
pathsConfig[plugin.modulePrefix] = PATH_PREFIX + plugin.path;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
pathsConfig['vs'] = PATH_PREFIX + METADATA.CORE.path;
|
|
|
|
pathsConfig['vs'] = PATH_PREFIX + RESOLVED_CORE_PATH;
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(JSON.stringify(pathsConfig, null, '\t'));
|
|
|
|
console.log('LOADER PATH CONFIGURATION: ');
|
|
|
|
|
|
|
|
console.log(JSON.stringify(pathsConfig, null, '\t'));
|
|
|
|
|
|
|
|
|
|
|
|
require.config({
|
|
|
|
require.config({
|
|
|
|
paths: pathsConfig
|
|
|
|
paths: pathsConfig
|
|
|
@ -41,10 +52,11 @@ function loadEditor(callback, PATH_PREFIX) {
|
|
|
|
|
|
|
|
|
|
|
|
require(['vs/editor/editor.main'], function() {
|
|
|
|
require(['vs/editor/editor.main'], function() {
|
|
|
|
// At this point we've loaded the monaco-editor-core
|
|
|
|
// At this point we've loaded the monaco-editor-core
|
|
|
|
require(METADATA.PLUGINS.map(function(plugin) { return plugin.contrib; }), function() {
|
|
|
|
require(RESOLVED_PLUGINS.map(function(plugin) { return plugin.contrib; }), function() {
|
|
|
|
// At this point we've loaded all the plugins
|
|
|
|
// At this point we've loaded all the plugins
|
|
|
|
callback();
|
|
|
|
callback();
|
|
|
|
// require(['./index'], function() {});
|
|
|
|
// require(['./index'], function() {});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|
|
|
|