[lexical-table] Fix: Preserve Background Color when pasting table rows inside table.#8131
Merged
etrepum merged 8 commits intofacebook:mainfrom Feb 12, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ivailop7
reviewed
Feb 10, 2026
pnpm-lock.yaml
Outdated
| engines: {node: '>= 10'} | ||
| cpu: [arm64] | ||
| os: [linux] | ||
| libc: [glibc] |
Collaborator
There was a problem hiding this comment.
I don't think the changes to the pnpm-lock.yaml should be commited
Collaborator
|
table tests are failing as well |
etrepum
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).