From e69e5b4f50ea3e2a904a4114ed86229b76c98722 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 19 May 2017 22:56:29 +0100 Subject: [PATCH] Ensure node labels are reordered properly to match outputs --- editor/js/ui/editor.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index 8d97d497a..ae4fa4c34 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -937,11 +937,20 @@ RED.editor = (function() { changed = true; } hasNonBlankLabel = false; - newValue = outputLabels.map(function() { + newValue = new Array(editing_node.outputs); + outputLabels.each(function() { + var index = $(this).attr('id').substring(23); // node-label-form-output- + if (outputMap.hasOwnProperty(index)) { + index = parseInt(outputMap[index]); + if (index === -1) { + return; + } + } var v = $(this).val(); hasNonBlankLabel = hasNonBlankLabel || v!== ""; - return v; - }).toArray().slice(0,editing_node.outputs); + newValue[index] = v; + }) + if ((editing_node.outputLabels === undefined && hasNonBlankLabel) || (editing_node.outputLabels !== undefined && JSON.stringify(newValue) !== JSON.stringify(editing_node.outputLabels))) { changes.outputLabels = editing_node.outputLabels;