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

Escape regex chars in palette filter input

This commit is contained in:
Nick O'Leary 2016-05-08 20:55:13 +01:00
parent feeba77f16
commit 8e6bba143a

View File

@ -369,7 +369,7 @@ RED.palette = (function() {
$("#palette-search-clear").show(); $("#palette-search-clear").show();
} }
var re = new RegExp(val,'i'); var re = new RegExp(val.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'),'i');
$("#palette-container .palette_node").each(function(i,el) { $("#palette-container .palette_node").each(function(i,el) {
var currentLabel = $(el).find(".palette_label").text(); var currentLabel = $(el).find(".palette_label").text();
if (val === "" || re.test(el.id) || re.test(currentLabel)) { if (val === "" || re.test(el.id) || re.test(currentLabel)) {