mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-23 17:05:53 +02:00
fix: 🐛 prevent html tags to be highlighted
This commit is contained in:
parent
cb38e6c5c1
commit
495571b8a7
|
@ -212,7 +212,8 @@ class ItemsList extends View {
|
|||
let highlightedName = name;
|
||||
for (let i = 0; i < keywords.length; i++) {
|
||||
const string = keywords[i];
|
||||
const regex = new RegExp(string, "gi");
|
||||
// check if keyword is not preceded by a < or </
|
||||
const regex = new RegExp(`(?<!<\/?)${string}`, "gi");
|
||||
highlightedName = highlightedName.replace(regex, "<strong>$&</strong>");
|
||||
}
|
||||
return `${highlightedName}`;
|
||||
|
|
Loading…
Reference in New Issue
Block a user