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 a2c9e0bf610..c0ef411ca34 100644
--- a/packages/lexical-playground/__tests__/e2e/CopyAndPaste/html/TablesHTMLCopyAndPaste.spec.mjs
+++ b/packages/lexical-playground/__tests__/e2e/CopyAndPaste/html/TablesHTMLCopyAndPaste.spec.mjs
@@ -106,6 +106,78 @@ test.describe('HTML Tables CopyAndPaste', () => {
);
});
+ test('Copy + paste (Table - Google Docs with custom widths)', async ({
+ page,
+ isPlainText,
+ isCollab,
+ }) => {
+ test.skip(isPlainText || isCollab);
+ await focusEditor(page);
+ const clipboard = {
+ 'text/html': `
`,
+ };
+ await pasteFromClipboard(page, clipboard);
+ await assertHTML(
+ page,
+ html`
+
+ + short + + |
+
+ + wide + + |
+
+ + default + + |
+
+ + a + + |
+
+ + b + + |
+
+ + c + + |
+
diff --git a/packages/lexical-table/src/LexicalTableNode.ts b/packages/lexical-table/src/LexicalTableNode.ts
index f3c0b74c778..2cf1538d17b 100644
--- a/packages/lexical-table/src/LexicalTableNode.ts
+++ b/packages/lexical-table/src/LexicalTableNode.ts
@@ -488,10 +488,14 @@ export function $convertTableElement(
if (colGroup) {
let columns: number[] | undefined = [];
for (const col of colGroup.querySelectorAll(':scope > col')) {
- const width = (col as HTMLElement).style.width;
- if (!width || !PIXEL_VALUE_REG_EXP.test(width)) {
- columns = undefined;
- break;
+ let width = (col as HTMLElement).style.width || '';
+ if (!PIXEL_VALUE_REG_EXP.test(width)) {
+ // Also support deprecated width attribute for google docs
+ width = col.getAttribute('width') || '';
+ if (!/^\d+$/.test(width)) {
+ columns = undefined;
+ break;
+ }
}
columns.push(parseFloat(width));
}
diff --git a/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx b/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx
index 38755a841e2..c5f208c51f8 100644
--- a/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx
+++ b/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx
@@ -650,9 +650,9 @@ describe('LexicalTableNode tests', () => {
html`
|