mirror of
https://github.com/zadam/trilium.git
synced 2026-03-24 04:40:13 +01:00
fix(search): wrong escape of highlighted tokens
This commit is contained in:
@@ -691,7 +691,7 @@ function highlightSearchResults(searchResults: SearchResult[], highlightedTokens
|
||||
// which would make the resulting HTML string invalid.
|
||||
// { and } are used for marking <b> and </b> tag (to avoid matches on single 'b' character)
|
||||
// < and > are used for marking <small> and </small>
|
||||
highlightedTokens = highlightedTokens.map((token) => token.replace("/[<\{\}]/g", "")).filter((token) => !!token?.trim());
|
||||
highlightedTokens = highlightedTokens.map((token) => token.replace(/[<>{}]/g, "")).filter((token) => !!token?.trim());
|
||||
|
||||
// sort by the longest, so we first highlight the longest matches
|
||||
highlightedTokens.sort((a, b) => (a.length > b.length ? -1 : 1));
|
||||
|
||||
Reference in New Issue
Block a user