Fix TR height being removed when pasting table from Google Sheets#3044
Fix TR height being removed when pasting table from Google Sheets#3044
Conversation
|
Add the fix in PastePlugin.ts in the googleSheets case block |
Co-authored-by: BryanValverdeU <8291124+BryanValverdeU@users.noreply.github.com>
|
That did not fix the issue, add |
Co-authored-by: BryanValverdeU <8291124+BryanValverdeU@users.noreply.github.com>
I've added the fix to PastePlugin.ts in the googleSheets case block as requested. The implementation adds a custom tableRow parser that extracts height values from TR elements and preserves them in the content model. This works alongside the existing fix in handleTable.ts to ensure row heights from Google Sheets tables are preserved during paste operations. Changes are in commit 1b95090. |
Added 'size' to the defaultFormatParsers in the tableRow property as requested. This change enables the built-in size format parser to handle table row heights properly. Changes are in commit 186c675. |
Issue
When pasting tables from Google Sheets into the editor, the row heights were not preserved, causing the table's appearance to change significantly. This affected tables with custom row heights that were carefully set in Google Sheets.
Root Cause
The row heights were correctly extracted from the DOM during parsing and stored in the
ContentModelTableRowobjects, but they weren't being applied back to the TR elements when converting from content model back to DOM.Solution
Added code to explicitly apply the row height directly to the TR element in
handleTable.ts:This ensures that when tables are pasted from Google Sheets, the row heights are preserved in the editor, maintaining the visual appearance of the original table.
Testing
Added unit tests to verify:
Before the fix, pasted tables would lose their custom row heights, resulting in a uniform, condensed appearance. After the fix, tables pasted from Google Sheets maintain their original row heights.
Fixes #3043.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.