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

palletLabel (if different) should be indexed

for search - fixes #3297
This commit is contained in:
Steve-Mcl 2022-01-26 16:14:34 +00:00
parent 0e7863a6fb
commit fdc4219b68

View File

@ -53,10 +53,22 @@ RED.search = (function() {
} }
l = l||n.label||n.name||n.id||""; l = l||n.label||n.name||n.id||"";
var properties = ['id','type','name','label','info']; var properties = ['id','type','name','label','info'];
if (n._def && n._def.defaults) { const node_def = n && n._def;
properties = properties.concat(Object.keys(n._def.defaults)); if (node_def) {
if (node_def.defaults) {
properties = properties.concat(Object.keys(node_def.defaults));
}
if (n.type !== "group" && node_def.paletteLabel && node_def.paletteLabel !== node_def.type) {
try {
const label = ("" + (typeof node_def.paletteLabel === "function" ? node_def.paletteLabel.call(node_def) : node_def.paletteLabel)).toLowerCase();
if(label && label !== (""+node_def.type).toLowerCase()) {
indexProperty(n, l, label);
}
} catch(err) {
console.warn(`error indexing ${l}`, err);
}
}
} }
for (var i=0;i<properties.length;i++) { for (var i=0;i<properties.length;i++) {
if (n.hasOwnProperty(properties[i])) { if (n.hasOwnProperty(properties[i])) {