add support for "bottom" sort, closes #4277

This commit is contained in:
zadam
2023-09-25 23:25:00 +02:00
parent 964abf390b
commit 984bd726e9
3 changed files with 17 additions and 1 deletions

View File

@@ -126,6 +126,14 @@ function sortNotes(parentNoteId, customSortBy = 'title', reverse = false, folder
return compare(topAEl, topBEl) * (reverse ? -1 : 1);
}
const bottomAEl = fetchValue(a, 'bottom');
const bottomBEl = fetchValue(b, 'bottom');
if (bottomAEl !== bottomBEl) {
// since "bottom" should not be reversible, we'll reverse it once more to nullify this effect
return compare(bottomBEl, bottomAEl) * (reverse ? -1 : 1);
}
const customAEl = fetchValue(a, customSortBy);
const customBEl = fetchValue(b, customSortBy);