diff --git a/editor/js/nodes.js b/editor/js/nodes.js index 1b901f069..2728a891b 100644 --- a/editor/js/nodes.js +++ b/editor/js/nodes.js @@ -431,6 +431,7 @@ RED.nodes = (function() { node.id = n.id; node.type = n.type; node.z = n.z; + if (node.type == "unknown") { for (var p in n._orig) { if (n._orig.hasOwnProperty(p)) { @@ -478,6 +479,14 @@ RED.nodes = (function() { node.wires[w.sourcePort].push(w.target.id); } } + + var labelCount; + if (n.inputs > 0 && n.inputLabels && !/^\s*$/.test(n.inputLabels.join(""))) { + node.inputLabels = n.inputLabels.slice(); + } + if (n.outputs > 0 && n.outputLabels && !/^\s*$/.test(n.outputLabels.join(""))) { + node.outputLabels = n.outputLabels.slice(); + } } return node; } @@ -893,7 +902,17 @@ RED.nodes = (function() { if (n.type !== "workspace" && n.type !== "tab" && n.type !== "subflow") { def = registry.getNodeType(n.type); if (!def || def.category != "config") { - var node = {x:n.x,y:n.y,z:n.z,type:0,wires:n.wires,changed:false,_config:{}}; + var node = { + x:n.x, + y:n.y, + z:n.z, + type:0, + wires:n.wires, + inputLabels: n.inputLabels, + outputLabels: n.outputLabels, + changed:false, + _config:{} + }; if (createNewIds) { if (subflow_blacklist[n.z]) { continue; diff --git a/editor/js/ui/common/stack.js b/editor/js/ui/common/stack.js index b273b9f22..2a5203cb7 100644 --- a/editor/js/ui/common/stack.js +++ b/editor/js/ui/common/stack.js @@ -62,6 +62,9 @@ RED.stack = (function() { }; entry.expand = function() { if (!entry.isExpanded()) { + if (entry.onexpand) { + entry.onexpand.call(entry); + } icon.addClass("expanded"); entry.content.slideDown(200); return true; diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index 3729dc22d..0b1b4b7b9 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -548,6 +548,79 @@ RED.editor = (function() { return dialogForm; } + function refreshLabelForm(container,node) { + var inputCount = node.inputs || node._def.inputs || 0; + var outputCount; + var i; + var formOutputs = parseInt($("#node-input-outputs").val()); + if (isNaN(formOutputs)) { + outputCount = node.outputs || node._def.outputs || 0; + } else { + outputCount = Math.max(0,formOutputs); + } + var inputsDiv = $("#node-label-form-inputs"); + var outputsDiv = $("#node-label-form-outputs"); + var children = inputsDiv.children(); + if (children.length < inputCount) { + for (i = children.length;i inputCount) { + for (i=inputCount;i outputCount) { + for (i=outputCount;i'); + var id = "node-label-form-"+type+"-"+index; + $('