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

Merge pull request #3380 from Steve-Mcl/search-find-filenode

Pallet Label (if different to type) should be indexed for search
This commit is contained in:
Nick O'Leary 2022-01-26 17:00:47 +00:00 committed by GitHub
commit a4fd63cd44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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])) {