Merge pull request #3200 from node-red/fix-link-call-label

Fix link call label
This commit is contained in:
Nick O'Leary 2021-10-14 12:04:25 +01:00 committed by GitHub
commit 2b38b5ea50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -4006,10 +4006,10 @@ RED.view = (function() {
var labelParts; var labelParts;
if (d.resize || this.__hideLabel__ !== hideLabel || this.__label__ !== label || this.__outputs__.length !== d.outputs) { if (d.resize || this.__hideLabel__ !== hideLabel || this.__label__ !== label || this.__outputs__.length !== d.outputs) {
labelParts = getLabelParts(label, "red-ui-flow-node-label"); labelParts = getLabelParts(label, "red-ui-flow-node-label");
this.__label__ = label; if (labelParts.lines.length !== this.__labelLineCount__ || this.__label__ !== label) {
if (labelParts.lines.length !== this.__labelLineCount__) {
d.resize = true; d.resize = true;
} }
this.__label__ = label;
this.__labelLineCount__ = labelParts.lines.length; this.__labelLineCount__ = labelParts.lines.length;
if (hideLabel) { if (hideLabel) {

View File

@ -242,6 +242,12 @@
}, },
oneditsave: function() { oneditsave: function() {
onEditSave(this); onEditSave(this);
// In case the name has changed, ensure any link call nodes on this
// tab are redrawn with the updated name
var localCallNodes = RED.nodes.filterNodes({z:RED.workspaces.active(), type:"link call"});
localCallNodes.forEach(function(node) {
node.dirty = true;
});
}, },
onadd: onAdd, onadd: onAdd,
oneditresize: resizeNodeList oneditresize: resizeNodeList
@ -267,12 +273,12 @@
} }
if (this.links.length > 0) { if (this.links.length > 0) {
var targetNode = RED.nodes.node(this.links[0]); var targetNode = RED.nodes.node(this.links[0]);
return targetNode && (targetNode.name || targetNode.id); return targetNode && (targetNode.name || this._("link.linkCall"));
} }
return this._("link.linkCall"); return this._("inject.none");
}, },
labelStyle: function() { labelStyle: function() {
return (this.name || this.links.length > 0)?"node_label_italic":""; return this.name?"node_label_italic":"";
}, },
oneditprepare: function() { oneditprepare: function() {
onEditPrepare(this,"link in"); onEditPrepare(this,"link in");
@ -283,7 +289,6 @@
oneditresize: resizeNodeList oneditresize: resizeNodeList
}); });
RED.nodes.registerType('link out',{ RED.nodes.registerType('link out',{
category: 'common', category: 'common',
color:"#ddd",//"#87D8CF", color:"#ddd",//"#87D8CF",