Skip to content

Conversation

@juliaroldi
Copy link
Contributor

@juliaroldi juliaroldi commented Jan 26, 2026

When pasting a complex table, with different cell number in each row, fill the gaps with spanned cells, making the table model uniform.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements automatic gap-filling for tables with irregular row lengths, ensuring all rows have the same number of cells by adding spanned cells where needed. This is particularly useful when pasting complex tables from external sources that may have inconsistent cell counts per row.

Changes:

  • Added logic to track the maximum column count across all table rows
  • Implemented gap-filling that extends short rows with spanLeft cells matching the properties of the last cell in each row
  • Added comprehensive test coverage for various gap-filling scenarios including simple short rows, header cells in short rows, and tables with colspan

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/roosterjs-content-model-dom/lib/domToModel/processors/tableProcessor.ts Implements the core gap-filling logic by tracking maxColumns and filling short rows with spanLeft cells that inherit properties from the last cell
packages/roosterjs-content-model-dom/test/domToModel/processors/tableProcessorTest.ts Adds new test cases for gap-filling scenarios and updates existing tests to reflect the uniform table structure created by gap-filling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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