mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Add support for running in the file protocol
This commit is contained in:
parent
abf4bd70a3
commit
a4e18e4226
2 changed files with 13 additions and 3 deletions
|
|
@ -4,8 +4,8 @@
|
||||||
CORE: {
|
CORE: {
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-editor-core/min/vs',
|
npm: 'node_modules/monaco-editor-core/min/vs',
|
||||||
dev: '/vscode/out/vs'
|
dev: '/vscode/out/vs',
|
||||||
// dev: '/vscode/out-monaco-editor-core/min/vs',
|
built: '/vscode/out-monaco-editor-core/min/vs',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PLUGINS: [{
|
PLUGINS: [{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
var IS_FILE_PROTOCOL = (window.location.protocol === 'file:');
|
||||||
|
|
||||||
var LOADER_OPTS = (function() {
|
var LOADER_OPTS = (function() {
|
||||||
function parseQueryString() {
|
function parseQueryString() {
|
||||||
var str = window.location.search;
|
var str = window.location.search;
|
||||||
|
|
@ -32,7 +34,15 @@
|
||||||
Component.prototype.getResolvedPath = function() {
|
Component.prototype.getResolvedPath = function() {
|
||||||
var resolvedPath = this.paths[this.selectedPath];
|
var resolvedPath = this.paths[this.selectedPath];
|
||||||
if (this.selectedPath === 'npm') {
|
if (this.selectedPath === 'npm') {
|
||||||
resolvedPath = '/monaco-editor/' + resolvedPath;
|
if (IS_FILE_PROTOCOL) {
|
||||||
|
resolvedPath = '../' + resolvedPath;
|
||||||
|
} else {
|
||||||
|
resolvedPath = '/monaco-editor/' + resolvedPath;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (IS_FILE_PROTOCOL) {
|
||||||
|
resolvedPath = '../..' + resolvedPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return resolvedPath;
|
return resolvedPath;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue