mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Add more test pages
This commit is contained in:
parent
0ba3ca8747
commit
0abdd95fe1
7 changed files with 402 additions and 55 deletions
42
test/dev-setup.js
Normal file
42
test/dev-setup.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
(function() {
|
||||
function getQueryStringValue (key) {
|
||||
return unescape(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
|
||||
}
|
||||
|
||||
// Resolve paths
|
||||
// should run the editor and/or plugins from source? (or from the node module)
|
||||
if (getQueryStringValue('editor') === 'dev') {
|
||||
METADATA.CORE.path = METADATA.CORE.srcPath;
|
||||
} else {
|
||||
METADATA.CORE.path = '/monaco-editor/' + METADATA.CORE.path;
|
||||
}
|
||||
METADATA.PLUGINS.forEach(function(plugin) {
|
||||
// should run the editor plugins from source? (or from node modules)
|
||||
if (plugin.srcPath && getQueryStringValue(plugin.name) === 'dev') {
|
||||
plugin.path = plugin.srcPath;
|
||||
} else {
|
||||
plugin.path = '/monaco-editor/' + plugin.path;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
function loadEditor(callback) {
|
||||
var pathsConfig = {};
|
||||
METADATA.PLUGINS.forEach(function(plugin) {
|
||||
pathsConfig[plugin.modulePrefix] = plugin.path;
|
||||
});
|
||||
pathsConfig['vs'] = METADATA.CORE.path;
|
||||
|
||||
require.config({
|
||||
paths: pathsConfig
|
||||
});
|
||||
|
||||
require(['vs/editor/editor.main'], function() {
|
||||
// At this point we've loaded the monaco-editor-core
|
||||
require(METADATA.PLUGINS.map(function(plugin) { return plugin.contrib; }), function() {
|
||||
// At this point we've loaded all the plugins
|
||||
callback();
|
||||
// require(['./index'], function() {});
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue