diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js index 4d8ccdd9d..8949d3b42 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js @@ -101,7 +101,7 @@ RED.utils = (function() { renderer.code = function (code, lang) { if(lang === "mermaid") { - // mermaid diagram rendering + // mermaid diagram rendering if (mermaidIsEnabled === undefined) { if (RED.settings.markdownEditor && RED.settings.markdownEditor.mermaid) { @@ -1118,6 +1118,22 @@ RED.utils = (function() { if (def.category === 'subflows') { return RED.settings.apiRootUrl+"icons/node-red/subflow.svg"; } + + if (node?.type) { + // this regex might be too restrictive/specific but got to start somewhere + const re = new RegExp("^\/"+node.type+"\/icon\/.*\.svg$","i"); + if (typeof def.icon === "function") { + try { + const di = def.icon.call(node); + if (re.test(di)) { return RED.settings.authTokensSuffix.replace(/-/,'/') + di; } + } + catch(e) { console.log("Bad Icon",e) } + } + else { + if (re.test(def.icon)) { return RED.settings.authTokensSuffix.replace(/-/,'/') + def.icon; } + } + } + return RED.settings.apiRootUrl+"icons/node-red/arrow-in.svg"; }