Skip to content

fix(extension-table): snapshot column widths on first resize - #8137

Open
sverg84 wants to merge 2 commits into
ueberdosis:mainfrom
sverg84:fix/table-column-resize-7560
Open

fix(extension-table): snapshot column widths on first resize#8137
sverg84 wants to merge 2 commits into
ueberdosis:mainfrom
sverg84:fix/table-column-resize-7560

Conversation

@sverg84

@sverg84 sverg84 commented Jul 28, 2026

Copy link
Copy Markdown

Fixes

Closes #7560

Changes and Review

  • Newly inserted resizable tables had no stored colwidth, so the first resize of a non-leading column let the browser redistribute untouched columns.
  • Snapshot rendered column widths on resize mousedown (before ProseMirror updates the dragged column), including colspan cells, and keep that snapshot out of undo history.
  • How to verify: insert a 3-column table → resize column 2 or 3 first → other columns keep their widths; undo undoes only the drag. Unit coverage is in columnResizeSnapshot.spec.ts.

Checklist

  • I have added a changeset if necessary.
  • I have added tests if possible.
  • I have made sure to test my changes myself.

Responsibility

  • I have reviewed and understand these changes, and I take responsibility for this PR, even if an AI agent created it.

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: be5419a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 74 packages
Name Type
@tiptap/extension-table Patch
@tiptap/extension-table-cell Patch
@tiptap/extension-table-header Patch
@tiptap/extension-table-row Patch
@tiptap/core Patch
@tiptap/extension-audio Patch
@tiptap/extension-blockquote Patch
@tiptap/extension-bold Patch
@tiptap/extension-bubble-menu Patch
@tiptap/extension-bullet-list Patch
@tiptap/extension-code-block-lowlight Patch
@tiptap/extension-code-block Patch
@tiptap/extension-code Patch
@tiptap/extension-collaboration-caret Patch
@tiptap/extension-collaboration Patch
@tiptap/extension-color Patch
@tiptap/extension-details Patch
@tiptap/extension-document Patch
@tiptap/extension-drag-handle-react Patch
@tiptap/extension-drag-handle-vue-2 Patch
@tiptap/extension-drag-handle-vue-3 Patch
@tiptap/extension-drag-handle Patch
@tiptap/extension-emoji Patch
@tiptap/extension-file-handler Patch
@tiptap/extension-find-and-replace Patch
@tiptap/extension-floating-menu Patch
@tiptap/extension-font-family Patch
@tiptap/extension-hard-break Patch
@tiptap/extension-heading Patch
@tiptap/extension-highlight Patch
@tiptap/extension-horizontal-rule Patch
@tiptap/extension-image Patch
@tiptap/extension-invisible-characters Patch
@tiptap/extension-italic Patch
@tiptap/extension-link Patch
@tiptap/extension-list Patch
@tiptap/extension-mathematics Patch
@tiptap/extension-mention Patch
@tiptap/extension-node-range Patch
@tiptap/extension-ordered-list Patch
@tiptap/extension-paragraph Patch
@tiptap/extension-ruby-text Patch
@tiptap/extension-strike Patch
@tiptap/extension-subscript Patch
@tiptap/extension-superscript Patch
@tiptap/extension-table-of-contents Patch
@tiptap/extension-text-align Patch
@tiptap/extension-text-style Patch
@tiptap/extension-text Patch
@tiptap/extension-twitch Patch
@tiptap/extension-typography Patch
@tiptap/extension-underline Patch
@tiptap/extension-unique-id Patch
@tiptap/extension-youtube Patch
@tiptap/extensions Patch
@tiptap/html Patch
@tiptap/markdown Patch
@tiptap/pm Patch
@tiptap/react Patch
@tiptap/starter-kit Patch
@tiptap/static-renderer Patch
@tiptap/suggestion Patch
@tiptap/vue-2 Patch
@tiptap/vue-3 Patch
@tiptap/extension-character-count Patch
@tiptap/extension-dropcursor Patch
@tiptap/extension-focus Patch
@tiptap/extension-gapcursor Patch
@tiptap/extension-history Patch
@tiptap/extension-list-item Patch
@tiptap/extension-list-keymap Patch
@tiptap/extension-placeholder Patch
@tiptap/extension-task-item Patch
@tiptap/extension-task-list Patch

Not sure what this means? Click here to learn what changesets are.

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

@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit be5419a
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/6a68e18504394c000919e09a
😎 Deploy Preview https://deploy-preview-8137--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 28, 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: f43b090d-cd24-41e7-8f90-df6f3361289c

📥 Commits

Reviewing files that changed from the base of the PR and between cfd5e7e and be5419a.

📒 Files selected for processing (2)
  • packages/extension-table/__tests__/columnResizeSnapshot.spec.ts
  • packages/extension-table/src/table/columnResizingSnapshot.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/extension-table/src/table/columnResizingSnapshot.ts

📝 Walkthrough

Summary

  • Fixes resizing for any column in newly inserted tables.
  • Snapshots rendered column widths before resizing, including colspan cells, while preserving valid colwidth values.
  • Keeps the snapshot out of undo history.
  • Adds unit tests and a patch changeset.

Walkthrough

Adds a column-resize snapshot plugin for editable resizable tables. It preserves rendered widths before the first resize, handles existing widths and colspans, integrates with the table plugin stack, and adds focused tests plus a patch changeset.

Changes

Table column resize behavior

Layer / File(s) Summary
Snapshot resize state
packages/extension-table/src/table/columnResizingSnapshot.ts
Reads rendered <col> widths, maps them to affected cells including colspan values, and updates colwidth without adding the snapshot transaction to history.
Table integration and coverage
packages/extension-table/src/table/table.ts, packages/extension-table/__tests__/columnResizeSnapshot.spec.ts, .changeset/...
Registers the snapshot plugin before column resizing and tests new tables, existing widths, missing widths, colspans, and undo behavior.

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

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

Suggested reviewers: arnaugomez, bdbch

Sequence Diagram(s)

sequenceDiagram
  participant EditorView
  participant columnResizingSnapshot
  participant DOMTable
  participant ProseMirrorTransaction
  EditorView->>columnResizingSnapshot: Receive resize mousedown
  columnResizingSnapshot->>DOMTable: Read rendered column widths
  columnResizingSnapshot->>ProseMirrorTransaction: Store cell colwidth values
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main fix: snapshotting column widths on first resize for extension-table.
Description check ✅ Passed The description matches the template and includes fixes, change summary, verification, and checklist items.
Linked Issues check ✅ Passed The changes address #7560 by snapshotting widths on resize mousedown so newly inserted tables keep working.
Out of Scope Changes check ✅ Passed The changes stay focused on the table resize bug, with tests and a changeset that support the fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sverg84
sverg84 marked this pull request as ready for review July 28, 2026 16:51
@sverg84
sverg84 requested a review from a team as a code owner July 28, 2026 16:51
@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 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/extension-table/src/table/columnResizingSnapshot.ts`:
- Around line 37-80: Update snapshotColumnWidths so the write-back condition is
evaluated per cell: preserve each cell’s existing valid colwidth and only apply
measured widths to cells whose colwidth is missing, invalid, or has the wrong
length. Keep the table-level early return and dispatch behavior intact, and add
a regression test covering a table with mixed valid and missing colwidth values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: ee71edf2-df5c-4435-9d9f-27f439b04036

📥 Commits

Reviewing files that changed from the base of the PR and between 5158212 and cfd5e7e.

📒 Files selected for processing (4)
  • .changeset/2026-07-28-fix-table-column-resize-snapshot.md
  • packages/extension-table/__tests__/columnResizeSnapshot.spec.ts
  • packages/extension-table/src/table/columnResizingSnapshot.ts
  • packages/extension-table/src/table/table.ts

Comment thread packages/extension-table/src/table/columnResizingSnapshot.ts
@coderabbitai coderabbitai Bot added area: editor Editor behavior, commands, and transactions and removed area: core Core editor engine and ProseMirror integration labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: editor Editor behavior, commands, and transactions 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.

[Bug] Table columns resize leads to broken behavior of rightmost columns.

1 participant