mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
added ancestor depth search criteria
This commit is contained in:
@@ -368,6 +368,20 @@ class Note {
|
||||
return arr;
|
||||
}
|
||||
|
||||
getDistanceToAncestor(ancestorNoteId) {
|
||||
if (this.noteId === ancestorNoteId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let minDistance = 999_999;
|
||||
|
||||
for (const parent of this.parents) {
|
||||
minDistance = Math.min(minDistance, parent.getDistanceToAncestor(ancestorNoteId) + 1);
|
||||
}
|
||||
|
||||
return minDistance;
|
||||
}
|
||||
|
||||
decrypt() {
|
||||
if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) {
|
||||
this.title = protectedSessionService.decryptString(this.title);
|
||||
|
||||
Reference in New Issue
Block a user