Fix name auto-generator to leave blank names alone on copy/paste

This commit is contained in:
Nick O'Leary
2022-04-19 19:17:41 +01:00
parent a7932da207
commit 908f9562f6
4 changed files with 52 additions and 21 deletions

View File

@@ -74,7 +74,7 @@
RED.nodes.registerType('debug',{
category: 'common',
defaults: {
name: {value:""},
name: {value:"_"},
active: {value:true},
tosidebar: {value:true},
console: {value:false},
@@ -546,7 +546,10 @@
$("#node-input-statusVal").val($("#node-input-typed-status").typedInput('value'));
},
onadd: function() {
RED.actions.invoke("core:generate-node-names",this)
if (this.name === '_') {
this.name = ''
RED.actions.invoke("core:generate-node-names", this)
}
}
});
})();

View File

@@ -218,7 +218,10 @@
}
function onAdd() {
RED.actions.invoke("core:generate-node-names",this)
if (this.name === '_') {
this.name = ''
RED.actions.invoke("core:generate-node-names", this)
}
for (var i=0;i<this.links.length;i++) {
var n = RED.nodes.node(this.links[i]);
@@ -232,7 +235,7 @@
category: 'common',
color:"#ddd",//"#87D8CF",
defaults: {
name: {value:""},
name: { value: "_" },
links: { value: [], type:"link out[]" }
},
inputs:0,
@@ -268,9 +271,9 @@
category: 'common',
color:"#ddd",//"#87D8CF",
defaults: {
name: {value:""},
links: { value: [], type:"link in[]"},
linkType: {value:"static"},
name: { value: "_" },
links: { value: [], type:"link in[]" },
linkType: { value:"static" },
timeout: { value: "30", validate:RED.validators.number(true) }
},
inputs: 1,
@@ -318,7 +321,10 @@
},
oneditresize: resizeNodeList,
onadd: function() {
RED.actions.invoke("core:generate-node-names",this)
if (this.name === '_') {
this.name = ''
RED.actions.invoke("core:generate-node-names", this)
}
}
});
@@ -326,9 +332,9 @@
category: 'common',
color:"#ddd",//"#87D8CF",
defaults: {
name: {value:""},
name: { value:"_" },
mode: { value: "link" },// link || return
links: { value: [], type:"link in[]"}
links: { value: [], type:"link in[]" }
},
align:"right",
inputs:1,