mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
have paths in "note paths" widget also sorted by priority
This commit is contained in:
@@ -99,24 +99,7 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
|
||||
function getSomeNotePathSegments(note, hoistedNotePath = 'root') {
|
||||
utils.assertArguments(note);
|
||||
|
||||
const notePaths = note.getAllNotePaths().map(path => ({
|
||||
notePath: path,
|
||||
isInHoistedSubTree: path.includes(hoistedNotePath),
|
||||
isArchived: path.find(noteId => treeCache.notes[noteId].hasLabel('archived')),
|
||||
isSearch: path.find(noteId => treeCache.notes[noteId].type === 'search')
|
||||
}));
|
||||
|
||||
notePaths.sort((a, b) => {
|
||||
if (a.isInHoistedSubTree !== b.isInHoistedSubTree) {
|
||||
return a.isInHoistedSubTree ? -1 : 1;
|
||||
} else if (a.isSearch !== b.isSearch) {
|
||||
return a.isSearch ? 1 : -1;
|
||||
} else if (a.isArchived !== b.isArchived) {
|
||||
return a.isArchived ? 1 : -1;
|
||||
} else {
|
||||
return a.notePath.length - b.notePath.length;
|
||||
}
|
||||
});
|
||||
const notePaths = note.getSortedNotePaths(hoistedNotePath);
|
||||
|
||||
return notePaths[0].notePath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user