Skip to content

[lexical-table] Fix: Preserve Background Color when pasting table rows inside table.#8131

Merged
etrepum merged 8 commits intofacebook:mainfrom
Sa-Te:fix/table-paste-background
Feb 12, 2026
Merged

[lexical-table] Fix: Preserve Background Color when pasting table rows inside table.#8131
etrepum merged 8 commits intofacebook:mainfrom
Sa-Te:fix/table-paste-background

Conversation

@Sa-Te
Copy link
Copy Markdown
Contributor

@Sa-Te Sa-Te commented Feb 10, 2026

The Issue:
When pasting rows or cells into an existing table, the TableCellNode creation logic in $insertTableIntoGrid was copying the cell's children (content) but failing to copy the cell's own style properties (specifically backgroundColor). This resulted in the background color being lost upon paste.

The Fix:

Updated $insertTableIntoGrid in LexicalTablePlugin.ts (or LexicalTableSelectionHelpers.ts).

Added logic to check templateCell.getBackgroundColor() and apply it to the target cell before inserting children.

Test Plan:

Manual Verification: Verified in Playground.

  • Created a table.

  • Applied a background color to a row.

  • Copied the row.

  • Pasted it into a new row.

Result: Background color is now preserved (previously lost).

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 10, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 11, 2026 3:06pm
lexical-playground Ready Ready Preview, Comment Feb 11, 2026 3:06pm

Request Review

pnpm-lock.yaml Outdated
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
libc: [glibc]
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.

I don't think the changes to the pnpm-lock.yaml should be commited

@ivailop7
Copy link
Copy Markdown
Collaborator

ivailop7 commented Feb 10, 2026

table tests are failing as well

@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Feb 11, 2026
@etrepum etrepum added this pull request to the merge queue Feb 12, 2026
Merged via the queue into facebook:main with commit e05c03e Feb 12, 2026
39 checks passed
@etrepum etrepum mentioned this pull request Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants