mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix autocomplete showing hidden paths, closes #3654
This commit is contained in:
parent
f883fde74a
commit
e2b8dfe96a
@ -28,15 +28,20 @@ class NoteFlatTextExp extends Expression {
|
||||
|
||||
if (retPath) {
|
||||
const noteId = retPath[retPath.length - 1];
|
||||
executionContext.noteIdToNotePath[noteId] = retPath;
|
||||
|
||||
resultNoteSet.add(becca.notes[noteId]);
|
||||
if (!resultNoteSet.hasNoteId(noteId)) {
|
||||
// we could get here from multiple paths, the first one wins because the paths
|
||||
// are sorted by importance
|
||||
executionContext.noteIdToNotePath[noteId] = retPath;
|
||||
|
||||
resultNoteSet.add(becca.notes[noteId]);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!note.parents.length === 0 || note.noteId === 'root') {
|
||||
if (note.parents.length === 0 || note.noteId === 'root') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -49,9 +54,11 @@ class NoteFlatTextExp extends Expression {
|
||||
}
|
||||
|
||||
for (const attribute of note.ownedAttributes) {
|
||||
const normalizedName = utils.normalize(attribute.name);
|
||||
const normalizedValue = utils.normalize(attribute.value);
|
||||
|
||||
for (const token of tokens) {
|
||||
if (utils.normalize(attribute.name).includes(token)
|
||||
|| utils.normalize(attribute.value).includes(token)) {
|
||||
if (normalizedName.includes(token) || normalizedValue.includes(token)) {
|
||||
foundAttrTokens.push(token);
|
||||
}
|
||||
}
|
||||
@ -70,10 +77,10 @@ class NoteFlatTextExp extends Expression {
|
||||
if (foundTokens.length > 0) {
|
||||
const remainingTokens = tokens.filter(token => !foundTokens.includes(token));
|
||||
|
||||
searchDownThePath(parentNote, remainingTokens, path.concat([note.noteId]));
|
||||
searchDownThePath(parentNote, remainingTokens, [...path, note.noteId]);
|
||||
}
|
||||
else {
|
||||
searchDownThePath(parentNote, tokens, path.concat([note.noteId]));
|
||||
searchDownThePath(parentNote, tokens, [...path, note.noteId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user