1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3273 from node-red-hitachi/fix-config-select-name

fix select menu label of config node to use paletteLabel
This commit is contained in:
Nick O'Leary 2021-12-01 14:02:55 +00:00 committed by GitHub
commit 682dff7c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -744,7 +744,16 @@ RED.editor = (function() {
delete cn.__label__;
});
select.append('<option value="_ADD_"'+(value===""?" selected":"")+'>'+RED._("editor.addNewType", {type:type})+'</option>');
var label = type;
if (typeof node_def.paletteLabel !== "undefined") {
try {
label = RED.utils.sanitize((typeof node_def.paletteLabel === "function" ? node_def.paletteLabel.call(node_def) : node_def.paletteLabel)||type);
} catch(err) {
console.log("Definition error: "+type+".paletteLabel",err);
}
}
select.append('<option value="_ADD_"'+(value===""?" selected":"")+'>'+RED._("editor.addNewType", {type:label})+'</option>');
window.setTimeout(function() { select.trigger("change");},50);
}
}