Skip to content

fix(core): toggle lists across all selected table cells - #8102

Open
youdie006 wants to merge 1 commit into
ueberdosis:mainfrom
youdie006:fix/toggle-list-table-cells
Open

fix(core): toggle lists across all selected table cells#8102
youdie006 wants to merge 1 commit into
ueberdosis:mainfrom
youdie006:fix/toggle-list-table-cells

Conversation

@youdie006

Copy link
Copy Markdown

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 (in packages/core) derived a single block range from selection.$from / selection.$to. A prosemirror-tables CellSelection is built as super(ranges[0].$from, ranges[0].$to, ranges), so its $from/$to resolve to the first cell only — even though selection.ranges already holds one range per selected cell. The single-range logic therefore toggled just the first cell.

Fix

When selection.ranges.length > 1 (a CellSelection, or any multi-range selection), toggle each range independently within one chained transaction: set a TextSelection inside each cell and re-invoke toggleList for 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.ts with 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

  • New spec: 4 pass. Red/green check: against the original toggleList, the three multi-cell cases fail as expected while the non-table case passes.
  • No regressions: packages/extension-list (104), packages/core + packages/extension-table (565) all pass; @tiptap/core build + 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).

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.
@youdie006
youdie006 requested a review from a team as a code owner July 21, 2026 11:29
@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a06c235

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit a06c235
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/6a5f5800b5066d00083f365e
😎 Deploy Preview https://deploy-preview-8102--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c3c2b7e4-5cbf-4e11-ba7a-fc12a9828c9f

📥 Commits

Reviewing files that changed from the base of the PR and between 2834eb3 and a06c235.

📒 Files selected for processing (2)
  • packages/core/src/commands/toggleList.ts
  • packages/extension-list/__tests__/toggleListInTable.spec.ts

📝 Walkthrough

Summary

  • Fixed list toggling for multiple selected table cells.
  • Added tests for row selections, full-table selections, reverting lists, and regular paragraphs.
  • Verified with tests, builds, type checks, and linting.

Walkthrough

toggleList now handles multi-range selections such as table CellSelection by toggling each selected cell independently. New tests cover bullet and ordered lists, reverting toggles, and unchanged behavior outside tables.

Changes

Multi-cell list toggling

Layer / File(s) Summary
Range-aware toggle workflow
packages/core/src/commands/toggleList.ts
Multi-range selections are processed cell by cell using updated transaction positions and per-cell TextSelection instances.
Multi-cell regression coverage
packages/extension-list/__tests__/toggleListInTable.spec.ts
Tests verify list toggling across table cells, reverting selected cells, and standard toggling outside tables.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: area: core, complexity: medium, impact: medium

Suggested reviewers: bdbch

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: list toggling now works across all selected table cells.
Description check ✅ Passed The PR explains the bug, fix, tests, and verification, but it doesn't follow the template headings exactly or include the checklist section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added area: core Core editor engine and ProseMirror integration complexity: medium Moderate change, possibly multiple files impact: medium Affects some users or workflows labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Core editor engine and ProseMirror integration complexity: medium Moderate change, possibly multiple files impact: medium Affects some users or workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List toggles (Bulleted/Ordered) only apply to the first cell selected in a Table

1 participant