githubnext/chopinPublic

Let's compose rich plans together

Add task list authoring: dash input rule and slash item #374

MergedMaggieAppletonmerged 3 commits intomainfromrefs/pull/374/head
  1. MA

    ## Why Task lists render and round-trip (checkboxes were restyled in #342), but people could not create them. `- [ ] ` left a bullet containing literal `[ ]`, and the slash menu had no item.

    ## What changed - `[] `, `[ ] ` and `[x] ` already converted through the markdown shortcuts. New: `- [ ] ` / `- [x] ` at line start now becomes a task item (it lifts the item out of its bullet list, splitting the list if needed). `task-rule.ts`, mounted in the toolbar, skipped when read-only. - New "Task list" slash item (Layout group; matches task, todo, checklist, checkbox). - Click on the box, and Space on a focused item, toggle; Enter on an empty task exits the list. These come from Lexical's check-list plugin that was already mounted. Verified in a browser, covered by e2e. - The dialect already parses and serializes task items (`- [ ]` / `- [x]`), so no server or dialect change. - No keyboard shortcut added: the editor has no list shortcuts today.

    ## Screenshots Before (typing `- [ ]`, `[x]`; bullets with literal brackets):

    ![before typed](https://github.com/user-attachments/assets/71c2fa89-321c-4f7e-aa7b-886404fc7f28)

    After:

    ![after typed](https://github.com/user-attachments/assets/4bbef468-e04f-4cd2-ba80-d3e60c76766b)

    Slash menu:

    ![after slash](https://github.com/user-attachments/assets/08156984-9487-4402-b53e-21eb43f4efb5)

    ## Verification

    Nine focused task-list tests, `bun run types`, `bun run ci`, and `bun run build` pass on the restacked branch. GitHub's browser suite will run on the final published head. The reviewed design hash was renewed after checking the integrated source.

  2. MaggieAppletonreferenced this in Make tabs authorable in place and label empty table headers #382last month on GitHub

  3. MA
    Author

    **Review:** Looks good

    Checked in a real browser (headless Chromium, fake-GitHub server on the PR build, plus a second user as peer).

    Works: - `- ` then `[ ] ` at an item's start converts to an empty task item, at list end, middle (list splits bullet / task / bullet) and as the only item. `- [x] ` gives a checked item with strikethrough. It survives reload and shows for a peer. - Slash menu "Task list" (`/task`) inserts a task item; it survives reload. - Not hijacked: `Say - [ ] hello [x] there` in a paragraph and `- foo [ ] bar` in a bullet stay literal. `[ ]` followed by a space after other text is ignored in the unit tests. - Nested bullet with a sibling stays literal (`[ ] n2`).

    Findings (none blocking): 1. `packages/editor/src/toolbar/task-rule.ts` `$liftIntoTaskList`: a nested bullet that is the only item in its sublist DOES convert (`list.setListType("check")`), while a nested item with siblings stays literal. So nesting behaviour is inconsistent. If "nested stays literal" is the intent, return false when `nested` before the sole-item branch; otherwise document that sole nested items convert and add a test for it. (Reload kept the result, so it is not corrupting.) 2. No undo to check: Mod+Z does nothing in the document editor on `main` either (the editor has no undo binding), so conversion can't be undone, same as every other edit. Pre-existing, not this PR. 3. Minor visual: the task item sits a little further from the preceding bullet list than bullets sit from each other (separate list blocks). Acceptable.

    `gh pr checks 374`: container pass, e2e pass, "format, lint, types, tests" fail. The failing step is `bun run ci` (the design-contract hash for `slash.tsx`, which the PR body flags); acceptable per process.

  4. MaggieAppletonhead-ref-force-pushed 6c03a79f90fblast month on GitHub

  5. MaggieAppletonreferenced this in Hide decision write actions for read-only viewers #293last month on GitHub

  6. MaggieAppletonhead-ref-force-pushed a0893feb4919last month on GitHub

  7. MaggieAppletonmerged 9701f3db2082last month on GitHub

  8. MaggieAppletonclosedlast month on GitHub

  9. MaggieAppletonhead-ref-deletedlast month on GitHub