mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
small refactorings
This commit is contained in:
parent
b793f8cb88
commit
5fd58def11
@ -87,14 +87,9 @@ class NoteCacheFlatTextExp extends Expression {
|
|||||||
if (note.type.includes(token) || note.mime.includes(token)) {
|
if (note.type.includes(token) || note.mime.includes(token)) {
|
||||||
foundAttrTokens.push(token);
|
foundAttrTokens.push(token);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (const attribute of note.ownedAttributes) {
|
for (const attribute of note.ownedAttributes) {
|
||||||
const lcName = attribute.name.toLowerCase();
|
if (attribute.name.includes(token) || attribute.value.includes(token)) {
|
||||||
const lcValue = attribute.value.toLowerCase();
|
|
||||||
|
|
||||||
for (const token of this.tokens) {
|
|
||||||
if (lcName.includes(token) || lcValue.includes(token)) {
|
|
||||||
foundAttrTokens.push(token);
|
foundAttrTokens.push(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,8 @@ function searchNotesForAutocomplete(query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function highlightSearchResults(searchResults, highlightedTokens) {
|
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
|
// we remove < signs because they can cause trouble in matching and overwriting existing highlighted chunks
|
||||||
// which would make the resulting HTML string invalid.
|
// 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 <b> and </b> tag (to avoid matches on single 'b' character)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user