diff --git a/editor/js/history.js b/editor/js/history.js
index 12650c9a2..20e1cb52f 100644
--- a/editor/js/history.js
+++ b/editor/js/history.js
@@ -229,10 +229,12 @@ RED.history = (function() {
}
});
}
+ RED.editor.validateNode(ev.node);
RED.nodes.filterNodes({type:"subflow:"+ev.node.id}).forEach(function(n) {
n.inputs = ev.node.in.length;
n.outputs = ev.node.out.length;
RED.editor.updateNodeProperties(n);
+ RED.editor.validateNode(n);
});
} else {
var outputMap;
diff --git a/editor/js/nodes.js b/editor/js/nodes.js
index b3c39fff1..8c8210c54 100644
--- a/editor/js/nodes.js
+++ b/editor/js/nodes.js
@@ -355,7 +355,7 @@ RED.nodes = (function() {
RED.nodes.registerType("subflow:"+sf.id, {
defaults:{name:{value:""}},
info: sf.info,
- icon:"subflow.png",
+ icon: function() { return sf.icon||"subflow.png" },
category: "subflows",
inputs: sf.in.length,
outputs: sf.out.length,
@@ -550,7 +550,11 @@ RED.nodes = (function() {
if (node.out.length > 0 && n.outputLabels && !/^\s*$/.test(n.outputLabels.join(""))) {
node.outputLabels = n.outputLabels.slice();
}
-
+ if (n.icon) {
+ if (n.icon !== "node-red/subflow.png") {
+ node.icon = n.icon;
+ }
+ }
return node;
}
diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js
index bf5b9bb49..e767283bc 100644
--- a/editor/js/ui/editor.js
+++ b/editor/js/ui/editor.js
@@ -48,7 +48,7 @@ RED.editor = (function() {
isValid = validateNode(subflow);
hasChanged = subflow.changed;
}
- node.valid = isValid;
+ node.valid = isValid && validateNodeProperties(node, node._def.defaults, node);
node.changed = node.changed || hasChanged;
} else if (node._def) {
node.valid = validateNodeProperties(node, node._def.defaults, node);
@@ -170,6 +170,10 @@ RED.editor = (function() {
}
}
}
+ validateIcon(node);
+ }
+
+ function validateIcon(node) {
if (node._def.hasOwnProperty("defaults") && !node._def.defaults.hasOwnProperty("icon") && node.icon) {
var iconPath = RED.utils.separateIconPath(node.icon);
var iconSets = RED.nodes.getIconSets();
@@ -188,6 +192,7 @@ RED.editor = (function() {
}
}
}
+
function validateNodeEditorProperty(node,defaults,property,prefix) {
var input = $("#"+prefix+"-"+property);
if (input.length > 0) {
@@ -742,7 +747,7 @@ RED.editor = (function() {
buildLabelRow().appendTo(outputsDiv);
}
- if ((!node._def.defaults || !node._def.defaults.hasOwnProperty("icon")) && node.type !== "subflow") {
+ if ((!node._def.defaults || !node._def.defaults.hasOwnProperty("icon"))) {
$('
').appendTo(dialogForm);
var iconDiv = $("#node-settings-icon");
$('