fix(core): toggle lists across all selected table cells - #8102
Conversation
toggleList derived a single block range from selection.$from/$to. For a table CellSelection those resolve to the first cell only, so a bulleted or ordered toggle over multiple selected cells only affected the first one (ueberdosis#7208). When the selection spans more than one range, toggle each range independently, reusing the same per-cell wrap/lift logic and processing ranges last-position-first so earlier positions stay valid. The single-range (non-table) path is unchanged.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary
Walkthrough
ChangesMulti-cell list toggling
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
What
In a table, selecting multiple cells and toggling a bulleted/ordered list only converted the first selected cell (#7208). This makes the toggle apply to every selected cell.
Root cause
toggleList(inpackages/core) derived a single block range fromselection.$from/selection.$to. A prosemirror-tablesCellSelectionis built assuper(ranges[0].$from, ranges[0].$to, ranges), so its$from/$toresolve to the first cell only — even thoughselection.rangesalready holds one range per selected cell. The single-range logic therefore toggled just the first cell.Fix
When
selection.ranges.length > 1(aCellSelection, or any multi-range selection), toggle each range independently within one chained transaction: set aTextSelectioninside each cell and re-invoketoggleListfor it, reusing the exact per-cell wrap/lift/change-type logic. Ranges are processed last-position-first so edits to later cells don't shift the positions of earlier, not-yet-processed cells. The single-range (non-table) path is left completely unchanged — the new branch only fires for multi-range selections, and each per-cell re-invocation sees a 1-range selection (so no recursion).Tests
New
packages/extension-list/__tests__/toggleListInTable.spec.tswith 4 cases: two selected cells in a row both become a list; a full 2x2 selection converts all four; a second toggle reverts every selected cell; and a plain non-table paragraph still toggles (regression guard).Verification
toggleList, the three multi-cell cases fail as expected while the non-table case passes.packages/extension-list(104),packages/core+packages/extension-table(565) all pass;@tiptap/corebuild + DTS type-check succeed; oxlint / oxfmt clean.Closes #7208.
AI disclosure: this PR was drafted with Claude Code (AI-assisted). Verified with the new test (including a red/green check) and the full extension-list / core / extension-table suites (no regressions).