Skip to content

feat(toolbar): add GFM table insertion and task-list commands - #362

Open
xiaoyao-yao wants to merge 2 commits into
floatboatai:mainfrom
xiaoyao-yao:feat/toolbar/table-and-tasklist-commands
Open

xiaoyao-yao wants to merge 2 commits into
floatboatai:mainfrom
xiaoyao-yao:feat/toolbar/table-and-tasklist-commands

Conversation

@xiaoyao-yao

Copy link
Copy Markdown

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 returning false when 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-toolbar tests pass; tsc --noEmit clean. Covers insertion variants, caret placement, selection-replace, multi-line task conversion, atomic undo, slash commands, and UI buttons.

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
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants