mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Don't mark a node changed when going from none to blank labels
This commit is contained in:
parent
5feb07583b
commit
879c0f4114
@ -879,14 +879,26 @@ RED.editor = (function() {
|
|||||||
var inputLabels = $("#node-label-form-inputs").children().find("input");
|
var inputLabels = $("#node-label-form-inputs").children().find("input");
|
||||||
var outputLabels = $("#node-label-form-outputs").children().find("input");
|
var outputLabels = $("#node-label-form-outputs").children().find("input");
|
||||||
|
|
||||||
newValue = inputLabels.map(function() { return $(this).val();}).toArray().slice(0,editing_node.inputs);
|
var hasNonBlankLabel = false;
|
||||||
if (JSON.stringify(newValue) !== JSON.stringify(editing_node.inputLabels)) {
|
newValue = inputLabels.map(function() {
|
||||||
|
var v = $(this).val();
|
||||||
|
hasNonBlankLabel = hasNonBlankLabel || v!== "";
|
||||||
|
return v;
|
||||||
|
}).toArray().slice(0,editing_node.inputs);
|
||||||
|
if ((editing_node.inputLabels === undefined && hasNonBlankLabel) ||
|
||||||
|
(editing_node.inputLabels !== undefined && JSON.stringify(newValue) !== JSON.stringify(editing_node.inputLabels))) {
|
||||||
changes.inputLabels = editing_node.inputLabels;
|
changes.inputLabels = editing_node.inputLabels;
|
||||||
editing_node.inputLabels = newValue;
|
editing_node.inputLabels = newValue;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
newValue = outputLabels.map(function() { return $(this).val();}).toArray().slice(0,editing_node.outputs);
|
hasNonBlankLabel = false;
|
||||||
if (JSON.stringify(newValue) !== JSON.stringify(editing_node.outputLabels)) {
|
newValue = outputLabels.map(function() {
|
||||||
|
var v = $(this).val();
|
||||||
|
hasNonBlankLabel = hasNonBlankLabel || v!== "";
|
||||||
|
return v;
|
||||||
|
}).toArray().slice(0,editing_node.outputs);
|
||||||
|
if ((editing_node.outputLabels === undefined && hasNonBlankLabel) ||
|
||||||
|
(editing_node.outputLabels !== undefined && JSON.stringify(newValue) !== JSON.stringify(editing_node.outputLabels))) {
|
||||||
changes.outputLabels = editing_node.outputLabels;
|
changes.outputLabels = editing_node.outputLabels;
|
||||||
editing_node.outputLabels = newValue;
|
editing_node.outputLabels = newValue;
|
||||||
changed = true;
|
changed = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user