mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
Remove reliance on loadDevEditor
This commit is contained in:
parent
745893d211
commit
17faf6a3b7
4 changed files with 11 additions and 16 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
<script>
|
<script>
|
||||||
window.MonacoEnvironment = {
|
window.MonacoEnvironment = {
|
||||||
getWorkerUrl: function() {
|
getWorkerUrl: function() {
|
||||||
return loadDevEditor() ? 'cross-origin-worker-proxy-dev.js' : 'cross-origin-worker-proxy.js';
|
return 'cross-origin-worker-proxy.js#http://localhost:8088' + RESOLVED_CORE_PATH;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
self.MonacoEnvironment = {
|
|
||||||
baseUrl: 'http://localhost:8088/vscode/out/'
|
|
||||||
};
|
|
||||||
importScripts('http://localhost:8088/vscode/out/vs/base/worker/workerMain.js');
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
|
var baseUrl = self.location.hash;
|
||||||
|
baseUrl = baseUrl.replace(/^#/, '');
|
||||||
|
baseUrl = baseUrl.replace(/vs$/, '');
|
||||||
|
|
||||||
|
console.log('WORKER BASE_URL: ' + baseUrl);
|
||||||
|
|
||||||
self.MonacoEnvironment = {
|
self.MonacoEnvironment = {
|
||||||
baseUrl: 'http://localhost:8088/monaco-editor/node_modules/monaco-editor-core/min/'
|
baseUrl: baseUrl
|
||||||
};
|
};
|
||||||
importScripts('http://localhost:8088/monaco-editor/node_modules/monaco-editor-core/min/vs/base/worker/workerMain.js');
|
importScripts(baseUrl + 'vs/base/worker/workerMain.js');
|
||||||
|
|
@ -42,10 +42,11 @@
|
||||||
|
|
||||||
|
|
||||||
var RESOLVED_CORE = new Component('editor', 'vs', METADATA.CORE.paths);
|
var RESOLVED_CORE = new Component('editor', 'vs', METADATA.CORE.paths);
|
||||||
|
self.RESOLVED_CORE_PATH = RESOLVED_CORE.getResolvedPath();
|
||||||
var RESOLVED_PLUGINS = METADATA.PLUGINS.map(function(plugin) {
|
var RESOLVED_PLUGINS = METADATA.PLUGINS.map(function(plugin) {
|
||||||
return new Component(plugin.name, plugin.modulePrefix, plugin.paths, plugin.contrib);
|
return new Component(plugin.name, plugin.modulePrefix, plugin.paths, plugin.contrib);
|
||||||
});
|
});
|
||||||
self.METADATA = null;
|
METADATA = null;
|
||||||
|
|
||||||
|
|
||||||
function loadScript(path, callback) {
|
function loadScript(path, callback) {
|
||||||
|
|
@ -58,14 +59,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
self.loadDevEditor = function() {
|
|
||||||
return (getQueryStringValue('editor') === 'dev');
|
|
||||||
}
|
|
||||||
function getQueryStringValue (key) {
|
|
||||||
return unescape(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
self.loadEditor = function(callback, PATH_PREFIX) {
|
self.loadEditor = function(callback, PATH_PREFIX) {
|
||||||
PATH_PREFIX = PATH_PREFIX || '';
|
PATH_PREFIX = PATH_PREFIX || '';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue