prevent IE script error

- even though monaco does not work in EI, scripts must not fail to load
This commit is contained in:
Steve-Mcl 2021-06-15 21:02:30 +01:00
parent 46d17c3314
commit a9cf34ab56
1 changed files with 4 additions and 3 deletions

View File

@ -121,7 +121,7 @@ RED.editor.codeEditor.monaco = (function() {
const def = modulesCache[libPath];
if( def ) {
if(!preloadOnly) {
loadedLibs.JS[libModule] = monaco.languages.typescript.javascriptDefaults.addExtraLib(def, `file://types/${libPackage}/${libModule}/index.d.ts`);
loadedLibs.JS[libModule] = monaco.languages.typescript.javascriptDefaults.addExtraLib(def, "file://types/" + libPackage + "/" + libModule + "/index.d.ts");
}
if(cb) {
setTimeout(function() {
@ -134,7 +134,7 @@ RED.editor.codeEditor.monaco = (function() {
.done(function(data) {
modulesCache[libPath] = data;
if(!preloadOnly) {
loadedLibs.JS[libModule] = monaco.languages.typescript.javascriptDefaults.addExtraLib(data, `file://types/${libPackage}/${libModule}/index.d.ts`);
loadedLibs.JS[libModule] = monaco.languages.typescript.javascriptDefaults.addExtraLib(data, "file://types/" + libPackage + "/" + libModule + "/index.d.ts");
}
if(cb) { cb(null, _module) }
})
@ -882,7 +882,8 @@ RED.editor.codeEditor.monaco = (function() {
if(!extraModuleLibs || extraModuleLibs.length == 0) {
loadedLibs.JS[id] = monaco.languages.typescript.javascriptDefaults.addExtraLib(" ", file);
} else {
var loadList = [...extraModuleLibs];
var loadList = [];
Array.prototype.push.apply(loadList, extraModuleLibs);//Use this instead of spread operator to prevent IE syntax error
var loadExtraModules = {};
for (let index = 0; index < extraModuleLibs.length; index++) {
const lib = extraModuleLibs[index];