feat(toolbar): add GFM table insertion and task-list commands - #362
Open
xiaoyao-yao wants to merge 2 commits into
Open
xiaoyao-yao wants to merge 2 commits into
xiaoyao-yao wants to merge 2 commits into
Conversation
Add insertTable() and toggleTaskList() formatting commands to the toolbar plugin, wired as slash commands and toolbar UI buttons. - insertTable builds a GitHub-Flavored Markdown table (configurable cols, rows, and an optional header row) as a single atomic replaceRange so the whole insertion collapses into one undo step; the caret lands inside the first body cell. - toggleTaskList converts plain text, bullets, and ordered lists into - [ ] task items, and toggles them off when every selected line is already a task item; the block is rewritten in one transaction for atomic undo. - Registers table/task-list slash commands, adds icons and toolbar buttons, and exports both commands from the package entry point. - Covers the new commands with 24 unit + atomic-undo + UI tests.
…task commands - Add toggleTaskChecked: flips - [ ] <-> - [x] per line, no-op (returns false) when no task items intersect the selection, atomic single undo - Wire toggleTaskChecked into exports, slash command (task-toggle) and UI - Document insertTable selection-replace semantic in JSDoc - Replace obscure $ substitution in toggleTaskList off-path with explicit group concatenation for readability and safety - Add tests for selection-replace, toggleTaskChecked, and task-toggle - Add OpenSpec change add-toolbar-table-tasklist (proposal/tasks/spec) to satisfy the new-public-API requirement surfaced in self-review
|
|
This branch has not been deployed
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
Adds three focused, undo-coherent GitHub-Flavored Markdown commands to the toolbar plugin:
insertTable— inserts a well-formed GFM table (configurable cols/rows/header) as one atomic transaction; caret lands in the first body cell; a non-empty selection is replaced.toggleTaskList— converts the selection's lines to- [ ]task items (plain text / ordered / unordered), or toggles them off when all are already tasks.toggleTaskChecked— flips- [ ]<->- [x]per line; no-op returningfalsewhen no task items intersect the selection.All three are wired into the package exports, the slash-command registry (
table,task-list,task-toggle), and the default toolbar UI, with matching SVG icons.Spec
Adds OpenSpec change
add-toolbar-table-tasklist(proposal / tasks / spec with scenarios).Tests
80
plugin-toolbartests pass;tsc --noEmitclean. Covers insertion variants, caret placement, selection-replace, multi-line task conversion, atomic undo, slash commands, and UI buttons.