Sorting protected notes #4178

Open
opened 2025-10-01 16:36:44 -05:00 by giteasync · 2 comments
Owner

Originally created by @cculbreath on GitHub.

Sorting the tree either from the content menu or sorted attribute causes any [Protected] notes to be sorted to the top of the tree. I have a few ideas that might improve this behavior without compromising the security of protected notes when outside the protected session.

  1. Special-case [Protected] to the end of the list by default.
  2. Implement a sortKey attribute to allow a user-assigned insecure name utilized in the sorting function
  3. Implement a sortIndex with 1 and -1 providing always-at-top or always-at-bottom sorting placement.
Originally created by @cculbreath on GitHub. Sorting the tree either from the content menu or `sorted` attribute causes any [Protected] notes to be sorted to the top of the tree. I have a few ideas that might improve this behavior without compromising the security of protected notes when outside the protected session. 1. Special-case [Protected] to the end of the list by default. 2. Implement a `sortKey` attribute to allow a user-assigned insecure name utilized in the sorting function 3. Implement a `sortIndex` with 1 and -1 providing always-at-top or always-at-bottom sorting placement.
giteasync added the
Difficulty: Hard
label 2025-10-01 16:36:44 -05:00
Author
Owner

@heimgreg commented on GitHub:

I really like these ideas. Maybe this can be generalized a bit, such that you can decide about the sorting direction (ascending vs. descending) or allowing more than one sortKey. You might want to sort by name first and by prefix second in one subtree, and the other way around in another subtree.

For sortkeys, the existing timestamps, created and updated, might be helpful (as mentioned in #824), as well as the branch prefix (see #162), or even the value of a custom label.

@heimgreg commented on GitHub: I really like these ideas. Maybe this can be generalized a bit, such that you can decide about the sorting direction (ascending vs. descending) or allowing more than one `sortKey`. You might want to sort by name first and by prefix second in one subtree, and the other way around in another subtree. For sortkeys, the existing timestamps, created and updated, might be helpful (as mentioned in #824), as well as the branch prefix (see #162), or even the value of a custom label.
Author
Owner

@zadam commented on GitHub:

I like the idea of having sortKey which would make sense also for non-protected notes if you need some custom sorting order.

@zadam commented on GitHub: I like the idea of having sortKey which would make sense also for non-protected notes if you need some custom sorting order.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TriliumNext/Trilium#4178
No description provided.