Fix highlighting regex for Safari < 16.3.

This commit is contained in:
Mario Zechner 2023-07-26 16:18:09 +02:00
parent 7b97b0f712
commit 651b15d4ff

View File

@ -213,7 +213,7 @@ class ItemsList extends View {
for (let i = 0; i < keywords.length; i++) {
const string = keywords[i];
// check if keyword is not preceded by a < or </
const regex = new RegExp(`(?<!<\/?)${string}`, "gi");
const regex = new RegExp(`<(?!\/?)(${string})`, "gi");
highlightedName = highlightedName.replace(regex, "<strong>$&</strong>");
}
return `${highlightedName}`;