* Fix (tasks): Toggle dropdown on re-click and narrow mark decoration range
- Clicking the dropdown icon now dismisses the completion menu if it
is already open (`closeCompletion`).
- The `data-task-state` mark decoration now covers only the inner state
text (excluding brackets). This prevents CodeMirror cursor/editing
issues when the caret is inside the brackets and allows bracket-aware
CSS styling. Example:
```space-style
[data-task-state="DONE"] { color: green; }
[data-task-state="PLANNED"] { color: orange; }
[data-task-state] { font-weight: bold; }
```
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
* Refactor (tasks): Unify task state data attribute to `data-task-state`
Rename `data-state` to `data-task-state` on extended task state spans in
Markdown renderer and update the corresponding places.
Previously the editor (CodeMirror mark decoration) used
`data-task-state` while the widget HTML renderer used `data-state`,
requiring duplicate CSS selectors. Now a single attribute selector works
everywhere (for example tasks rendered using `template.taskItem` also
follow the styling now):
```css
[data-task-state="PLANNED"] { /* cool CSS here */; }
```
Note: Checkbox inputs (`[ ]`/`[x]`/`[X]`) still use `data-state` since
they follow a different code path.
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
---------
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
* Add a dropdown picker for custom task states
Add a dropdown picker for custom task states that appears as a small
triangle next to the `[state]` allowing to quickly switch between
defined states with autocomplete.
States marked as done receive strikethrough styling on the task text.
Each state can be styled individually using the `data-task-state`
attribute, for example:
```space-style
[data-task-state=PLANNED] .sb-task-state {
color: black;
background-color: orange;
}
```
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
* Keep the current task state visible while the dropdown picker is open
Keep the current task state visible while the dropdown picker is open by
disabling built-in filtering and handling it manually — when the state
text exactly matches a known state all options are shown, otherwise
results are filtered by what the user has typed so far.
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
* Added on-hover completion styling
* Fix: Show all defined task states in the dropdown when clicking the picker on an unrecognized state instead of showing an empty menu
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
---------
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
Co-authored-by: Zef Hemel <zef@zef.me>