feat: add checkbox support to notes with show_checkbox schema flag#134
Merged
Conversation
The 00_text_note.rhai library script was merged into 00_text_note.schema.rhai but test includes weren't updated.
Adds `is_checked: bool` to the Note struct with `#[serde(default)]`, adds a DB migration for the `is_checked INTEGER NOT NULL DEFAULT 0` column, updates schema.sql DDL, NoteRow tuple (13→14 elements), map_note_row, note_from_row_tuple, and all 7 SELECT/INSERT statements that feed or write note rows.
Add SetChecked to the Operation enum and wire it into all 7 match methods (operation_id, timestamp, device_id, author_key, set_author_key, set_signature, get_signature) plus operation_log type name table. sync.rs match gaps are intentionally deferred to Task 4.
Implements set_note_checked() that updates is_checked in the DB, logs a SetChecked operation, signs it, and pushes a NoteRestore undo entry. Extends NoteRestore with old_is_checked so undo and redo correctly restore the checked state. Adds test_set_note_checked test covering check, persist, uncheck, and undo.
Adds `show_checkbox: bool` to the Schema struct (parsed from the Rhai map, defaults false). Exposes `is_checked` in both `build_note_map` (live Note) and `pending_note_to_dynamic` (save-transaction context).
Add SetChecked handler to apply_remote_op, include is_checked in CreateNote sync INSERT with default 0, add SetChecked to operation_type_str, and include is_checked in export/import INSERT.
- Add set_note_checked command in commands/notes.rs (returns updated Note) - Register in generate_handler! in lib.rs - Add show_checkbox field to SchemaInfo struct and schema_to_info mapping - Add isChecked to TS Note interface and showCheckbox to SchemaInfo - Fix useSchema.ts mock objects to include showCheckbox - Fix krillnotes-rbac gate.rs exhaustive match for SetChecked operation
Add interactive checkbox to TreeNode when schema.showCheckbox is true, with strikethrough title styling for checked items; wire onToggleChecked handler through WorkspaceView → TreeView → TreeNode; add i18n keys for checkNote/uncheckNote in all 7 locale files.
The frontend persists the selected view tab name across note
selections. Using "Details" for TodoItem caused a mismatch when
switching between TextNote ("Content") and TodoItem.
Native <input type="checkbox"> with React controlled checked prop doesn't reliably fire onChange when unchecking in Tauri's WKWebView. Use a styled button with role="checkbox" instead.
Two bugs: 1. handleToggleChecked updated notes state but didn't rebuild the tree, so the TreeNode never saw the isChecked change. 2. activeTab wasn't reset synchronously when switching notes, causing render_view to fire with a stale view label for the new note type.
Effect 4 can fire in the same render cycle as Effect 1, before
setActiveTab('fields') takes effect. Guard by checking that activeTab
matches a loaded view for the current note before calling render_view.
…itch State updates from Effect 1 (setActiveTab, setViews) don't take effect until the next render, so Effect 4 fires in the same cycle with stale values. A ref (viewsForNoteRef) is cleared synchronously at the top of Effect 1 and only restored after the async view fetch, giving Effect 4 a reliable check that the views belong to the current note.
Adds `set_checked(note_id, checked)` to the Rhai scripting API so that scripts can programmatically toggle the checkbox state during on_save hooks and tree actions. Follows the existing set_title/set_field pattern using PendingNote and the thread-local SaveTransaction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is_checked: boolto theNotestruct as a first-class global field (liketitle), with DB migration,SetCheckedoperation variant for CRDT sync, and undo supportshow_checkbox: boolschema flag — when set, TreeNode renders an interactive checkbox before the title with strikethrough styling for checked itemsTodoItemsystem script (show_checkbox: true,is_leaf: true, body textarea) as a ready-to-use checklist note typeTest plan
cargo test -p krillnotes-core)npx tsc --noEmit)isCheckedand shows strikethroughshow_checkbox) has no checkboxis_checkedstatenote.is_checkedshow_checkbox: truealso get the checkbox