mirror of
https://github.com/zadam/trilium.git
synced 2025-02-19 12:34:54 +08:00
small refactorings
This commit is contained in:
parent
b793f8cb88
commit
5fd58def11
2 changed files with 4 additions and 7 deletions
|
@ -87,14 +87,9 @@ class NoteCacheFlatTextExp extends Expression {
|
|||
if (note.type.includes(token) || note.mime.includes(token)) {
|
||||
foundAttrTokens.push(token);
|
||||
}
|
||||
}
|
||||
|
||||
for (const attribute of note.ownedAttributes) {
|
||||
const lcName = attribute.name.toLowerCase();
|
||||
const lcValue = attribute.value.toLowerCase();
|
||||
|
||||
for (const token of this.tokens) {
|
||||
if (lcName.includes(token) || lcValue.includes(token)) {
|
||||
for (const attribute of note.ownedAttributes) {
|
||||
if (attribute.name.includes(token) || attribute.value.includes(token)) {
|
||||
foundAttrTokens.push(token);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,8 @@ function searchNotesForAutocomplete(query) {
|
|||
}
|
||||
|
||||
function highlightSearchResults(searchResults, highlightedTokens) {
|
||||
highlightedTokens = Array.from(new Set(highlightedTokens));
|
||||
|
||||
// we remove < signs because they can cause trouble in matching and overwriting existing highlighted chunks
|
||||
// which would make the resulting HTML string invalid.
|
||||
// { and } are used for marking <b> and </b> tag (to avoid matches on single 'b' character)
|
||||
|
|
Loading…
Reference in a new issue