Feat/003 markdown view checkboxes - #7
Merged
Conversation
Add an optional onChange to MarkdownView. When provided, toggling a task checkbox applies the change to the document in a component-owned transaction (resolving the node position by identity) and reports the full serialized Markdown. A returned Promise drives a component-wide busy state: every checkbox is disabled and muted while the save is in flight, further clicks are swallowed, and a rejection rolls back to the last confirmed Markdown. A void return applies without a busy state. The factory gains an onReadOnlyChecked option forwarded to TaskItem; the sync effect is now guarded so an echoed content prop does not rebuild the document, and a genuinely new content becomes the confirmed baseline. MarkdownView stays editable: false — text is not editable. Refs spec 003-markdown-view-checkboxes
…OM order Add MarkdownView tests for read-only revert, optimistic toggle reporting, component-wide busy/disable, rollback on rejection (incl. only-the-failed- change), the content-prop guard and echo/win cases, and edge cases. Fix position resolution: the extension-list task-item node view is reused across updates, so the node handed to onReadOnlyChecked goes stale and identity lookup fails on any re-toggle. Resolve the toggled item by DOM order instead (the one <li> whose live checkbox disagrees with its data-checked), which maps to the nth taskItem in document order. Refs spec 003-markdown-view-checkboxes
Document the additive MarkdownView onChange (three engagement levels and the consumer-owns-authorization note) as an agent-executable upgrade prompt, and mark all implementation steps complete. Refs spec 003-markdown-view-checkboxes
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.
This pull request introduces interactive checkboxes to the
MarkdownViewcomponent, allowing users to tick task list items directly in the read-only Markdown renderer. The change is fully backward-compatible and includes comprehensive documentation, test coverage, and spec updates. No behavior changes occur unless the newonChangeprop is provided.Interactive MarkdownView checkboxes
MarkdownViewnow accepts an optionalonChangeprop. When provided, task list checkboxes become interactive: ticking a box applies the change immediately and callsonChangewith the updated Markdown. IfonChangereturns a Promise, all checkboxes are disabled until it settles, and the view rolls back on rejection. OmittingonChangeleaves checkboxes read-only, preserving previous behavior. [1] [2]Documentation and upgrade guidance
docs/upgrade-to-0.12.mdwith upgrade instructions, usage patterns, and best practices for wiringonChangein consumer apps.README.mdto document the new interactive checkbox feature inMarkdownView.Specification and test coverage
specs/INDEX.md.specs/003-markdown-view-checkboxes/steps.md.markdown-view.test.tsxwith thorough tests for all interaction scenarios, including optimistic updates, busy state, rollback, and edge cases.Known issues and TODOs