diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js b/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js index c5a0b31fb..7815efc7d 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js @@ -498,7 +498,7 @@ RED.diff = (function() { nodeDiv.css('backgroundColor',colour); var iconContainer = $('
',{class:"palette_icon_container"}).appendTo(nodeDiv); - RED.utils.createIconElement(icon_url, iconContainer, false, def, node); + RED.utils.createIconElement(icon_url, iconContainer, false); return nodeDiv; } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js index 626abcf76..782b9aeac 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js @@ -830,7 +830,7 @@ RED.editor = (function() { var icon_url = RED.utils.getNodeIcon(node._def,node); nodeDiv.css('backgroundColor',colour); var iconContainer = $('
',{class:"palette_icon_container"}).appendTo(nodeDiv); - RED.utils.createIconElement(icon_url, iconContainer, true, node._def, node); + RED.utils.createIconElement(icon_url, iconContainer, true); iconButton.click(function(e) { e.preventDefault(); @@ -844,7 +844,7 @@ RED.editor = (function() { showIconPicker(iconRow,node,iconPath,function(newIcon) { $("#node-settings-icon").text(newIcon||""); var icon_url = RED.utils.getNodeIcon(node._def,{type:node.type,icon:newIcon}); - RED.utils.createIconElement(icon_url, iconContainer, true, node._def, node); + RED.utils.createIconElement(icon_url, iconContainer, true); }); }); $('
').text(node.icon).appendTo(iconButton); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js index 49faceac7..1fc4deaeb 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js @@ -144,7 +144,7 @@ RED.palette = (function() { function setIcon(element,sf) { var icon_url = RED.utils.getNodeIcon(sf._def); var iconContainer = element.find(".palette_icon_container"); - RED.utils.createIconElement(icon_url, iconContainer, true, sf._def); + RED.utils.createIconElement(icon_url, iconContainer, true); } function escapeNodeType(nt) { @@ -182,7 +182,7 @@ RED.palette = (function() { if (def.icon) { var icon_url = RED.utils.getNodeIcon(def); var iconContainer = $('
',{class:"palette_icon_container"+(def.align=="right"?" palette_icon_container_right":"")}).appendTo(d); - RED.utils.createIconElement(icon_url, iconContainer, true, def); + RED.utils.createIconElement(icon_url, iconContainer, true); } d.style.backgroundColor = RED.utils.getNodeColor(nt,def); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js index e5fa59914..cce7dddf3 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js @@ -203,7 +203,7 @@ RED.search = (function() { nodeDiv.css('backgroundColor',colour); var iconContainer = $('
',{class:"palette_icon_container"}).appendTo(nodeDiv); - RED.utils.createIconElement(icon_url, iconContainer, true, node._def, node); + RED.utils.createIconElement(icon_url, iconContainer, true); var contentDiv = $('
',{class:"red-ui-search-result-description"}).appendTo(div); if (node.z) { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js b/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js index a99d90b58..0e0ce98b3 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js @@ -133,7 +133,7 @@ RED.typeSearch = (function() { nodeDiv.css('backgroundColor',colour); var iconContainer = $('
',{class:"palette_icon_container"}).appendTo(nodeDiv); - RED.utils.createIconElement(icon_url, iconContainer, false, def); + RED.utils.createIconElement(icon_url, iconContainer, false); if (def.inputs > 0) { $('
',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv); 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 43d3cced3..d8a4f1e7d 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 @@ -782,15 +782,18 @@ RED.utils = (function() { } var iconPath = getDefaultNodeIcon(def, node); - if (def.category === 'subflows') { - if (!isIconExists(iconPath)) { - return RED.settings.apiRootUrl+"icons/node-red/subflow.png"; + if (isIconExists(iconPath)) { + if (iconPath.module === "font-awesome") { + return iconPath.module+"/"+iconPath.file; + } else { + return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file; } - } - if (iconPath.module === "font-awesome") { - return iconPath.module+"/"+iconPath.file; } else { - return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file; + if (def.category === 'subflows') { + return RED.settings.apiRootUrl+"icons/node-red/subflow.png"; + } else { + return RED.settings.apiRootUrl+"icons/node-red/arrow-in.png"; + } } } @@ -904,10 +907,8 @@ RED.utils = (function() { * @param iconUrl - Url of icon. * @param iconContainer - Icon container element with palette_icon_container class. * @param isLarge - Whether the icon size is large. - * @param def - Default definition of a node. - * @param node - If the icon is a specific node instance, this parameter must be specified. If it is icon template such as an icon on the palette, this must be omitted. */ - function createIconElement(iconUrl, iconContainer, isLarge, def, node) { + function createIconElement(iconUrl, iconContainer, isLarge) { // Removes the previous icon when icon was changed. var iconElement = iconContainer.find(".palette_icon"); if (iconElement.length !== 0) { @@ -928,13 +929,8 @@ RED.utils = (function() { faIconElement.addClass("palette_icon_fa fa fa-fw " + faLarge + iconPath.file); return; } - // If the specified name is not defined in font-awesome, show the default icon. - if (def) { - var iconPath = RED.utils.getDefaultNodeIcon(def, node); - iconUrl = RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file; - } else { - iconUrl = RED.settings.apiRootUrl+"icons/node-red/arrow-in.png" - } + // If the specified name is not defined in font-awesome, show arrow-in icon. + iconUrl = RED.settings.apiRootUrl+"icons/node-red/arrow-in.png" } var imageIconElement = $('
',{class:"palette_icon"}).appendTo(iconContainer); imageIconElement.css("backgroundImage", "url("+iconUrl+")");