mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix search button in palette popover
This commit is contained in:
parent
940a246160
commit
d273c38194
@ -171,23 +171,15 @@ RED.palette = (function() {
|
|||||||
}
|
}
|
||||||
metaData += type;
|
metaData += type;
|
||||||
|
|
||||||
|
const safeType = type.replace(/'/g,"\\'");
|
||||||
|
const searchType = type.indexOf(' ') > -1 ? '"' + type + '"' : type
|
||||||
|
|
||||||
if (/^subflow:/.test(type)) {
|
if (/^subflow:/.test(type)) {
|
||||||
$('<button type="button" onclick="RED.workspaces.show(\''+type.substring(8).replace(/'/g,"\\'")+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-pencil"></i></button>').appendTo(popOverContent)
|
$('<button type="button" onclick="RED.workspaces.show(\''+type.substring(8).replace(/'/g,"\\'")+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-pencil"></i></button>').appendTo(popOverContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
const safeType = type.replace(/'/g,"\\'");
|
$('<button type="button" onclick="RED.search.show(\'type:'+searchType+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-search"></i></button>').appendTo(popOverContent)
|
||||||
const wrapStr = function (str) {
|
|
||||||
if(str.indexOf(' ') >= 0) {
|
|
||||||
return '"' + str + '"'
|
|
||||||
}
|
|
||||||
return str
|
|
||||||
}
|
|
||||||
|
|
||||||
$('<button type="button"; return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-search"></i></button>')
|
|
||||||
.appendTo(popOverContent)
|
|
||||||
.on('click', function() {
|
|
||||||
RED.search.show('type:' + wrapStr(safeType))
|
|
||||||
})
|
|
||||||
$('<button type="button" onclick="RED.sidebar.help.show(\''+safeType+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-book"></i></button>').appendTo(popOverContent)
|
$('<button type="button" onclick="RED.sidebar.help.show(\''+safeType+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-book"></i></button>').appendTo(popOverContent)
|
||||||
|
|
||||||
$('<p>',{style:"font-size: 0.8em"}).text(metaData).appendTo(popOverContent);
|
$('<p>',{style:"font-size: 0.8em"}).text(metaData).appendTo(popOverContent);
|
||||||
|
Loading…
Reference in New Issue
Block a user