Merge branch 'dev' of github.com:node-red/node-red into dev

This commit is contained in:
Nick O'Leary
2022-01-26 17:46:47 +00:00
5 changed files with 79 additions and 3 deletions

View File

@@ -53,10 +53,22 @@ RED.search = (function() {
}
l = l||n.label||n.name||n.id||"";
var properties = ['id','type','name','label','info'];
if (n._def && n._def.defaults) {
properties = properties.concat(Object.keys(n._def.defaults));
const node_def = n && n._def;
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++) {
if (n.hasOwnProperty(properties[i])) {

View File

@@ -378,6 +378,9 @@ class Subflow extends Flow {
if (name === "NR_NODE_ID") {
return node.id;
}
if (name === "NR_NODE_PATH") {
return node._path;
}
}
if (node.g) {
const group = this.getGroupNode(node.g);

View File

@@ -529,6 +529,9 @@ function getSetting(node, name, flow_) {
if (name === "NR_NODE_ID") {
return node.id;
}
if (name === "NR_NODE_PATH") {
return node._path;
}
}
var flow = (flow_ ? flow_ : (node ? node._flow : null));
if (flow) {