Skip to content

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

Merged
etrepum merged 8 commits into
facebook: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 into
facebook:mainfrom
Sa-Te:fix/table-paste-background

Conversation

@Sa-Te

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

Copy link
Copy Markdown
Contributor

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

vercel Bot commented Feb 10, 2026

Copy link
Copy Markdown

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

Comment thread 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

ivailop7 commented Feb 10, 2026

Copy link
Copy Markdown
Collaborator

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

3 participants