Merge pull request #5106 from node-red/5090-fix-label-action

Handle link nodes with show/hide label action
pull/4887/merge
Nick O'Leary 2025-04-25 17:44:16 +01:00 committed by GitHub
commit 833687fd55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View File

@ -46,10 +46,20 @@ RED.contextMenu = (function () {
hasEnabledNode = true; hasEnabledNode = true;
} }
} }
if (n.l === undefined || n.l) { if (n.l === undefined) {
hasLabeledNode = true; // 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 { } 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) { nodes.forEach(function(n) {
var modified = false; 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 (labelShown) {
if (n.l === false || (!showLabel && !n.hasOwnProperty('l'))) { if (n.l === false || (!showLabel && !n.hasOwnProperty('l'))) {