From 056ec7544a0edfd7c624e3f455473e205593a083 Mon Sep 17 00:00:00 2001
From: Jash Vithlani <jvithlani@rippling.com>
Date: Sat, 22 Feb 2025 14:43:23 +0530
Subject: [PATCH 1/2] [lexical-table] fix: table cell background copy paste not
 working

---
 packages/lexical-table/src/LexicalTableSelectionHelpers.ts | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/packages/lexical-table/src/LexicalTableSelectionHelpers.ts b/packages/lexical-table/src/LexicalTableSelectionHelpers.ts
index 10d83e36bbf..8472dca94de 100644
--- a/packages/lexical-table/src/LexicalTableSelectionHelpers.ts
+++ b/packages/lexical-table/src/LexicalTableSelectionHelpers.ts
@@ -800,6 +800,9 @@ export function applyTableHandlers(
             }
 
             const originalChildren = currentGridCellNode.getChildren();
+            currentGridCellNode.setBackgroundColor(
+              newGridCellNode.getBackgroundColor(),
+            );
             newGridCellNode.getChildren().forEach((child) => {
               if ($isTextNode(child)) {
                 const paragraphNode = $createParagraphNode();

From 91074d05987a1250ebb9763e9f65a2a43fcea8b5 Mon Sep 17 00:00:00 2001
From: Jash Vithlani <jvithlani@rippling.com>
Date: Mon, 3 Mar 2025 12:31:56 +0530
Subject: [PATCH 2/2] added tests

---
 .../CopyAndPaste/html/TablesHTMLCopyAndPaste.spec.mjs    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/packages/lexical-playground/__tests__/e2e/CopyAndPaste/html/TablesHTMLCopyAndPaste.spec.mjs b/packages/lexical-playground/__tests__/e2e/CopyAndPaste/html/TablesHTMLCopyAndPaste.spec.mjs
index 7f462e36d5b..1b7c5cc87ec 100644
--- a/packages/lexical-playground/__tests__/e2e/CopyAndPaste/html/TablesHTMLCopyAndPaste.spec.mjs
+++ b/packages/lexical-playground/__tests__/e2e/CopyAndPaste/html/TablesHTMLCopyAndPaste.spec.mjs
@@ -386,7 +386,8 @@ test.describe('HTML Tables CopyAndPaste', () => {
           </colgroup>
           <tr>
             <th
-              class="PlaygroundEditorTheme__tableCell PlaygroundEditorTheme__tableCellHeader PlaygroundEditorTheme__tableCellSelected">
+              class="PlaygroundEditorTheme__tableCell PlaygroundEditorTheme__tableCellHeader PlaygroundEditorTheme__tableCellSelected"
+              style="background-color: rgb(242, 243, 245)">
               <p
                 class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
                 dir="ltr">
@@ -394,7 +395,8 @@ test.describe('HTML Tables CopyAndPaste', () => {
               </p>
             </th>
             <th
-              class="PlaygroundEditorTheme__tableCell PlaygroundEditorTheme__tableCellHeader PlaygroundEditorTheme__tableCellSelected">
+              class="PlaygroundEditorTheme__tableCell PlaygroundEditorTheme__tableCellHeader PlaygroundEditorTheme__tableCellSelected"
+              style="background-color: rgb(242, 243, 245)">
               <p
                 class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
                 dir="ltr">
@@ -412,7 +414,8 @@ test.describe('HTML Tables CopyAndPaste', () => {
           </tr>
           <tr>
             <th
-              class="PlaygroundEditorTheme__tableCell PlaygroundEditorTheme__tableCellHeader PlaygroundEditorTheme__tableCellSelected">
+              class="PlaygroundEditorTheme__tableCell PlaygroundEditorTheme__tableCellHeader PlaygroundEditorTheme__tableCellSelected"
+              style="background-color: rgb(242, 243, 245)">
               <p
                 class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
                 dir="ltr">