zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

[FEATURE] Get `unfinished` notes (text notes with unchecked checkboxes) #1637

Closed nil0x42 closed 3 years ago

nil0x42 commented 3 years ago

Hi ! I am a heavy user of day notes and generally of ckeditor to-do lists in my workflow. Therefore, i frequently forget old notes with a pending task.

I would like to make a js plugin that checks if a text note has at least one to-do list checkbox unchecked, so i can decide to highlight it, or create a saved search note to be able to list notes with pending tasks.

Do you have some insight on how to achieve that ?

PS: If trilium was my baby, i would even include it as a built-in note property note.todoCount (defaulting to 0 for non-text notes)

zadam commented 3 years ago

Hi, checking the generated source of unchecked todo item, it looks like this:

<input type="checkbox" disabled="disabled">

So in a script, I would just do something like:

note.getContent().includes('<input type="checkbox" disabled="disabled">');

In upcoming 0.46 I would create a saved search with this search string:

note.rawContent *=* '<input type="checkbox" disabled="disabled">'

(rawContent was just added and is not available in 0.45.X)

nil0x42 commented 3 years ago

In upcoming 0.46 I would create a saved search with this search string:

note.rawContent *=* '<input type="checkbox" disabled="disabled">'

Wow ! awesome, i can't wait to try v0.46 :)

nil0x42 commented 3 years ago

After trying & testing this feature in v0.46.0-beta with success, i'm now proud user of my new saved search:

Notes with pending tasks

note.type = text note.rawContent *=* '<input type="checkbox" disabled="disabled">'

So i'm closing this issue :)