From a9cf34ab56f0c9707605502c06afa147d58f1202 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Tue, 15 Jun 2021 21:02:30 +0100 Subject: [PATCH] prevent IE script error - even though monaco does not work in EI, scripts must not fail to load --- .../editor-client/src/js/ui/editors/code-editors/monaco.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js index 3c221df4e..6d31ecd59 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js @@ -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];