Description
When pasting HTML from applications like Microsoft Excel, Google Sheets, and some email clients, styles are often defined in <style> blocks using class selectors instead of inline styles.
Example:
<style>
.foo { background: red; color: blue; }
</style>
<table>
<tr>
<td class="foo">Hello</td>
</tr>
</table>
Currently, Lexical’s import pipeline only reads (most) inline styles (element.style.), so all class-based styles (background color, text color, font size, etc.) are silently lost.
Use Cases
- Pasting tables from Excel → cell backgrounds, width and text colors are lost
- Pasting formatted content from some email clients
- Any HTML import where styles are defined via <style> instead of inline
Proposed Solution
Add a pre-processing step at the start to inline CSS rules from <style> tags before the conversion.
This ensures all existing converters automatically support these styles without modification.
Impact
Any Lexical user pasting from Excel, Google Sheets, Outlook, or similar tools
Scope:
- Affects all Lexical-based editors
- Changes live in:
- @lexical/html (import pipeline)
- @lexical/table (color propagation)
Frequency:
- Copy-paste from spreadsheets and email is extremely common in enterprise workflows.
- Losing formatting is a frequent and highly visible UX issue.
| EXCEL TABLE |
AFTER COPY |
 |
 |
Description
When pasting HTML from applications like Microsoft Excel, Google Sheets, and some email clients, styles are often defined in
<style>blocks using class selectors instead of inline styles.Example:
Currently, Lexical’s import pipeline only reads (most) inline styles (element.style.), so all class-based styles (background color, text color, font size, etc.) are silently lost.
Use Cases
Proposed Solution
Add a pre-processing step at the start to inline CSS rules from <style> tags before the conversion.
This ensures all existing converters automatically support these styles without modification.
Impact
Any Lexical user pasting from Excel, Google Sheets, Outlook, or similar tools
Scope:
Frequency: