diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js index 9f20cc674..322283fcb 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js @@ -175,9 +175,19 @@ RED.palette = (function() { $('').appendTo(popOverContent) } - var safeType = type.replace(/'/g,"\\'"); + const safeType = type.replace(/'/g,"\\'"); + function wrapStr(str) { + if(str.indexOf(' ') >= 0) { + return '"' + str + '"' + } + return str + } - $('').appendTo(popOverContent) + $('') + .appendTo(popOverContent) + .on('click', function() { + RED.search.show('type:' + wrapStr(safeType)) + }) $('').appendTo(popOverContent) $('
',{style:"font-size: 0.8em"}).text(metaData).appendTo(popOverContent);
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js
index f9cc79f08..d8035908a 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js
@@ -106,14 +106,26 @@ RED.search = (function() {
return val;
}
+ function extractType(val, flags) {
+ // extracts: type:XYZ & type:"X Y Z"
+ console.log(`extractType(val, flags): val:${val}`)
+ const regEx = /(?:type):\s*(?:"([^"]+)"|([^" ]+))/;
+ let m
+ while ((m = regEx.exec(val)) !== null) {
+ // avoid infinite loops with zero-width matches
+ if (m.index === regEx.lastIndex) {
+ regEx.lastIndex++;
+ }
+ val = val.replace(m[0]," ").trim()
+ const flag = m[2] || m[1] // quoted entries in capture group 1, unquoted in capture group 2
+ flags.type = flags.type || [];
+ flags.type.push(flag);
+ }
+ return val;
+ }
+
function search(val) {
var results = [];
- var typeFilter;
- var m = /(?:^| )type:([^ ]+)/.exec(val);
- if (m) {
- val = val.replace(/(?:^| )type:[^ ]+/,"");
- typeFilter = m[1];
- }
var flags = {};
val = extractFlag(val,"invalid",flags);
val = extractFlag(val,"unused",flags);
@@ -121,18 +133,20 @@ RED.search = (function() {
val = extractFlag(val,"subflow",flags);
val = extractFlag(val,"hidden",flags);
val = extractFlag(val,"modified",flags);
- val = extractValue(val,"flow",flags);// flow:active or flow: