Handle link nodes with show/hide label action

5090-fix-label-action
Nick O'Leary 2025-04-14 10:36:51 +01:00
parent 71501dd6aa
commit 2c71e11fbf
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 15 additions and 5 deletions

View File

@ -46,10 +46,20 @@ RED.contextMenu = (function () {
hasEnabledNode = true;
}
}
if (n.l === undefined || n.l) {
hasLabeledNode = true;
if (n.l === undefined) {
// Check if the node sets showLabel in the defaults
// as that determines the default behaviour for the node
if (n._def.showLabel !== false) {
hasLabeledNode = true;
} else {
hasUnlabeledNode = true;
}
} else {
hasUnlabeledNode = true;
if (n.l) {
hasLabeledNode = true;
} else {
hasUnlabeledNode = true;
}
}
}
}

View File

@ -176,8 +176,8 @@ RED.view.tools = (function() {
}
nodes.forEach(function(n) {
var modified = false;
var oldValue = n.l === undefined?true:n.l;
var showLabel = n._def.hasOwnProperty("showLabel")?n._def.showLabel:true;
var showLabel = n._def.hasOwnProperty("showLabel") ? n._def.showLabel : true;
var oldValue = n.l === undefined ? showLabel : n.l;
if (labelShown) {
if (n.l === false || (!showLabel && !n.hasOwnProperty('l'))) {