-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Summary
Preserve table cell background colors, borders, padding, and vertical alignment when pasting from Google Docs.
Problem
Table cell styling is lost when pasting from Google Docs. Cells with background colors paste as plain white, borders and padding are dropped.
Repro
- Create a table in Google Docs with colored cells (e.g., yellow background, blue background).
- Copy the table and paste into SuperDoc.
- All cell colors, borders, and padding are missing.
Expected
Table cell background colors, borders, padding, and vertical alignment from pasted content are preserved.
Notes
table-cell.js has parseDOM: [{ tag: 'td' }] with no attribute extraction. The background attribute has a renderDOM but no parseDOM. Google Docs sends all cell styling as inline CSS on <td> elements:
{"backgroundColor":"rgb(255, 255, 0)","verticalAlign":"top","padding":"5pt","border":"0.681818pt solid rgb(128, 128, 128)"}The fix should add parseDOM handlers to the background attribute that reads elem.style.backgroundColor and converts it via cssColorToHex. Similarly for verticalAlign, cellMargins (from padding), and borders.
File: packages/super-editor/src/extensions/table-cell/table-cell.js
Want to work on this? Check the Contributing Guide to get started. Comment on the GitHub issue to let us know you're picking it up.
Want to work on this? Check the Contributing Guide to get started. Comment on this issue to let us know you're picking it up.
Ref: SD-1979