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

Hide the subflow check logic inside getDefaultNodeIcon function

This commit is contained in:
Kazuki-Nakanishi 2018-03-22 14:14:09 +09:00
parent d9350b2362
commit 8b0e76dd55
2 changed files with 4 additions and 9 deletions

View File

@ -787,12 +787,7 @@ RED.editor = (function() {
var clear = $('<button class="editor-button editor-button-small"><i class="fa fa-times"></i></button>').appendTo(iconForm);
clear.click(function(evt) {
evt.preventDefault();
var iconPath;
if (node.type === "subflow") {
iconPath = { module:"node-red", file:"subflow.png" };
} else {
iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
}
var iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
selectIconModule.val(iconPath.module);
moduleChange(selectIconModule, selectIconFile, iconModuleHidden, iconFileHidden, iconSets, true);
selectIconFile.removeClass("input-error");

View File

@ -708,7 +708,9 @@ RED.utils = (function() {
function getDefaultNodeIcon(def,node) {
var icon_url;
if (typeof def.icon === "function") {
if (node && node.type === "subflow") {
icon_url = "node-red/subflow.png";
} else if (typeof def.icon === "function") {
try {
icon_url = def.icon.call(node);
} catch(err) {
@ -753,8 +755,6 @@ RED.utils = (function() {
if (isIconExists(iconPath)) {
return "icons/" + node.icon;
}
} else if (node && node.type === 'subflow') {
return "icons/node-red/subflow.png"
}
var iconPath = getDefaultNodeIcon(def, node);