Skip to content

Merge pasted adjacent tables - #3449

Merged
Julia Roldi (juliaroldi) merged 4 commits into
masterfrom
u/juliaroldi/paste-table
Aug 25, 2026
Merged

Merge pasted adjacent tables#3449
Julia Roldi (juliaroldi) merged 4 commits into
masterfrom
u/juliaroldi/paste-table

Conversation

@juliaroldi

@juliaroldi Julia Roldi (juliaroldi) commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Merge a pasted table into the table immediately before the insertion point instead of creating a separate adjacent table. The merge supports different column counts and appends the pasted rows without reapplying destination table formatting, preserving source cell border colors.

MergeTables

How to test

  1. Run yarn test:fast --testPathPattern=mergeModelTest.
  2. Place the caret directly after a table and paste another table. Verify the pasted rows join the preceding table for both matching and different column counts, and that the pasted cells retain their original border colors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-25 23:19 UTC

Comment on lines +353 to +354
previousBlock.rows[0]?.cells.length > 0 &&
newTable.rows[0]?.cells.length > 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What if their cells count are different?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. At first, only the new rows were added to the end of the table, but after the model was updated, that changed the table’s appearance. I added code to expand the smaller table to match the size of the larger one.
MergeTablesDiffSize

@juliaroldi
Julia Roldi (juliaroldi) merged commit 8378463 into master Aug 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants