Skip to content

fix(super-editor): preserve rows without cells when merging#3845

Open
bogdanyluk wants to merge 1 commit into
superdoc-dev:mainfrom
bogdanyluk:fix/3782-merging-multiple-table-rows
Open

fix(super-editor): preserve rows without cells when merging#3845
bogdanyluk wants to merge 1 commit into
superdoc-dev:mainfrom
bogdanyluk:fix/3782-merging-multiple-table-rows

Conversation

@bogdanyluk

Copy link
Copy Markdown

Fixes #3782

Summary

Fixes table formatting corruption after merging multiple full-width rows in an imported DOCX.

Root cause

ProseMirror represents a full-width vertical merge as:

  • A merged cell with colspan and rowspan
  • An empty continuation row
  • The following normal rows

When serialized, the empty row has no content property. The layout adapter discarded this row, causing the next row to be processed while the merged columns were still occupied. AutoFit then placed its cells in additional columns, widening the table and rendering cells outside its right boundary.

Fix

  • Preserve structurally empty table rows in the layout adapter.
  • Normalize missing row content to an empty array.
  • Keep empty rows in the table’s row timeline so rowspans advance correctly.
  • Continue omitting tables where every row is empty.
  • Add regression coverage for a full-width, multi-row merge followed by a normal row.

Screenshots

Before

зображення

After

зображення

Test Plan

  • Import .docx with a table (from the issue).
  • Confirm the table initially renders with three aligned columns.
  • Select every cell across two or more adjacent blank rows and merge them.
  • Verify the merged cell spans the full table width and both selected rows.
  • Verify all subsequent rows remain aligned to the original three-column grid.
  • Verify no cells protrude beyond the table’s right edge.
  • Undo and redo the merge and confirm the table remains correctly formatted.

ProseMirror's `mergeCells` command can result in table rows that contain
no
cells. Previously, these rows were filtered out during conversion to
`FlowBlock[]`, which could lead to incorrect row counts and rendering
when
a cell with a `rowspan` attribute covered these empty rows.

This change modifies `parseTableRow` to ensure that structurally empty
rows
are preserved, preventing rendering issues with vertically merged cells.

Fixes superdoc-dev#3782
@bogdanyluk
bogdanyluk requested a review from a team as a code owner July 23, 2026 22:27
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merging multiple rows in a table causes formatting issues

1 participant