fix regexp search in manager

This commit is contained in:
tophf 2017-12-28 07:01:18 +03:00
parent d9f8d1361f
commit c1dd196acd

View File

@ -293,7 +293,7 @@ function searchStyles({immediately, container}) {
const words = rx ? null : const words = rx ? null :
query.startsWith('"') && query.endsWith('"') ? [value.trim().slice(1, -1)] : query.startsWith('"') && query.endsWith('"') ? [value.trim().slice(1, -1)] :
query.split(/\s+/).filter(s => s.length > 1); query.split(/\s+/).filter(s => s.length > 1);
if (!words.length) { if (words && !words.length) {
words.push(query); words.push(query);
} }
const entries = container && container.children || container || installed.children; const entries = container && container.children || container || installed.children;
@ -301,7 +301,7 @@ function searchStyles({immediately, container}) {
new Set(BG.filterStyles({matchUrl: query}).map(style => style.id)); new Set(BG.filterStyles({matchUrl: query}).map(style => style.id));
let needsRefilter = false; let needsRefilter = false;
for (const entry of entries) { for (const entry of entries) {
let isMatching = !query || !words.length; let isMatching = !query || words && !words.length;
if (!isMatching) { if (!isMatching) {
const style = urlMode ? siteStyleIds.has(entry.styleId) : const style = urlMode ? siteStyleIds.has(entry.styleId) :
BG.cachedStyles.byId.get(entry.styleId) || {}; BG.cachedStyles.byId.get(entry.styleId) || {};