mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-05 00:05:28 +02:00
Revert "Merge pull request #140 from unki2aut/fix/highlighting"
This reverts commitd8d893cc6c
, reversing changes made to041f7810ee
.
This commit is contained in:
parent
d8d893cc6c
commit
7b97b0f712
|
@ -209,9 +209,14 @@ class ItemsList extends View {
|
|||
}
|
||||
|
||||
highlightMatches(keywords, name) {
|
||||
// check if keyword is not preceded by a < or </
|
||||
const regex = new RegExp(`(?<!<\/?)${keywords.join("|")}`, "gi");
|
||||
return name.replace(regex, "<strong>$&</strong>");
|
||||
let highlightedName = name;
|
||||
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");
|
||||
highlightedName = highlightedName.replace(regex, "<strong>$&</strong>");
|
||||
}
|
||||
return `${highlightedName}`;
|
||||
}
|
||||
|
||||
renderItem(item) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user