Skip to content

Commit b7ddcb6

Browse files
committed
PB-61: Left Panel Search Bar Returning Results
1 parent 3a5d67e commit b7ddcb6

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/panel.js

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/panel.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,14 @@ export default class Panel {
9292
_.filter(
9393
Config.getConfig("content_types"),
9494
(contentType: ContentTypeConfigInterface) => {
95-
const regEx = new RegExp("\\b" + self.searchValue(), "gi");
96-
const matches = !!contentType.label.toLowerCase().match(regEx);
97-
return matches &&
98-
contentType.is_system === true;
95+
if (contentType.is_system !== true) {
96+
return false;
97+
}
98+
99+
const escapedSearchValue = self.searchValue().replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
100+
const regEx = new RegExp("\\b" + escapedSearchValue, "gi");
101+
102+
return regEx.test(contentType.label.toLowerCase());
99103
},
100104
),
101105
(contentType, identifier: string) => {

0 commit comments

Comments
 (0)