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:
parent
d9350b2362
commit
8b0e76dd55
@ -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);
|
var clear = $('<button class="editor-button editor-button-small"><i class="fa fa-times"></i></button>').appendTo(iconForm);
|
||||||
clear.click(function(evt) {
|
clear.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
var iconPath;
|
var iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
|
||||||
if (node.type === "subflow") {
|
|
||||||
iconPath = { module:"node-red", file:"subflow.png" };
|
|
||||||
} else {
|
|
||||||
iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
|
|
||||||
}
|
|
||||||
selectIconModule.val(iconPath.module);
|
selectIconModule.val(iconPath.module);
|
||||||
moduleChange(selectIconModule, selectIconFile, iconModuleHidden, iconFileHidden, iconSets, true);
|
moduleChange(selectIconModule, selectIconFile, iconModuleHidden, iconFileHidden, iconSets, true);
|
||||||
selectIconFile.removeClass("input-error");
|
selectIconFile.removeClass("input-error");
|
||||||
|
@ -708,7 +708,9 @@ RED.utils = (function() {
|
|||||||
|
|
||||||
function getDefaultNodeIcon(def,node) {
|
function getDefaultNodeIcon(def,node) {
|
||||||
var icon_url;
|
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 {
|
try {
|
||||||
icon_url = def.icon.call(node);
|
icon_url = def.icon.call(node);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
@ -753,8 +755,6 @@ RED.utils = (function() {
|
|||||||
if (isIconExists(iconPath)) {
|
if (isIconExists(iconPath)) {
|
||||||
return "icons/" + node.icon;
|
return "icons/" + node.icon;
|
||||||
}
|
}
|
||||||
} else if (node && node.type === 'subflow') {
|
|
||||||
return "icons/node-red/subflow.png"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var iconPath = getDefaultNodeIcon(def, node);
|
var iconPath = getDefaultNodeIcon(def, node);
|
||||||
|
Loading…
Reference in New Issue
Block a user