1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

@ -121,7 +121,7 @@ RED.editor.codeEditor.monaco = (function() {
const def = modulesCache[libPath]; const def = modulesCache[libPath];
if( def ) { if( def ) {
if(!preloadOnly) { 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) { if(cb) {
setTimeout(function() { setTimeout(function() {
@ -134,7 +134,7 @@ RED.editor.codeEditor.monaco = (function() {
.done(function(data) { .done(function(data) {
modulesCache[libPath] = data; modulesCache[libPath] = data;
if(!preloadOnly) { 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) } if(cb) { cb(null, _module) }
}) })
@ -882,7 +882,8 @@ RED.editor.codeEditor.monaco = (function() {
if(!extraModuleLibs || extraModuleLibs.length == 0) { if(!extraModuleLibs || extraModuleLibs.length == 0) {
loadedLibs.JS[id] = monaco.languages.typescript.javascriptDefaults.addExtraLib(" ", file); loadedLibs.JS[id] = monaco.languages.typescript.javascriptDefaults.addExtraLib(" ", file);
} else { } 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 = {}; var loadExtraModules = {};
for (let index = 0; index < extraModuleLibs.length; index++) { for (let index = 0; index < extraModuleLibs.length; index++) {
const lib = extraModuleLibs[index]; const lib = extraModuleLibs[index];