mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-30 12:27:15 +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;
|
let highlightedName = name;
|
||||||
for (let i = 0; i < keywords.length; i++) {
|
for (let i = 0; i < keywords.length; i++) {
|
||||||
const string = keywords[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>");
|
highlightedName = highlightedName.replace(regex, "<strong>$&</strong>");
|
||||||
}
|
}
|
||||||
return `${highlightedName}`;
|
return `${highlightedName}`;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user