microsoft / microsoft/roosterjs
table cellpadding and cellspacing values get lost on exportContent
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 190
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 16
Description
Describe the bug
When a table element has cellpadding and cellspacing attribute set, the cellpadding and cellspacing values get lost on exportContent.
I noticed in tableSpacingFormatHandler.ts, it is setting border-collapse as collapse if cellpadding is set for the table. At the same time, border-spacing is set as 0. However, when the cellpadding and cellspacing values are non-zero, the table will be rendered differently than expected.
To Reproduce
Steps to reproduce the behavior:
- Insert a table with cellpadding and cellspacing set as 20
- Trigger 'Export as HTML'
- Inspect the table exported
- The style of exported table will be"box-sizing: border-box; border-collapse: collapse; border-spacing: 0px;"
Expected behavior
cellpadding= 20 and cellspacing=20 should be converted to css styles accordingly
Device Information
- Browser [All]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tableSpacingFormatHandler.ts and trace how exportContent handles tables with cellpadding and cellspacing. Reproduce the issue by exporting a table with both values set to 20, then inspect the generated HTML styles. Done means the exported table preserves the expected spacing and padding rather than forcing collapse and zero spacing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100