fix(editor): emit theme link styles in renderHTML#3418
Conversation
Link mark's renderHTML now merges the active EmailTheming `link` component styles into the emitted `<a>` `style` attribute, with user-declared inline styles appended last so the CSS cascade preserves overrides. Also adds link color+underline to RESET_MINIMAL so minimal theme ships a default too. Fixes plain links losing styling after HTML <-> visual mode round-trips.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 9af91a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
No issues found across 5 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would require human review. Modifies core HTML rendering logic and style merging for the Link mark. Changes to serialization logic in the editor's core path should be reviewed by a human.
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Shadow auto-approve: would auto-approve. Isolated fix to ensure link styles are correctly emitted in HTML export. Includes comprehensive test coverage and follows established patterns for style merging.
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Shadow auto-approve: would auto-approve. Safe bug fix for link styling persistence. It merges theme-aware styles in renderHTML, includes comprehensive tests, and poses low risk to core infrastructure.
Summary
<a style="...">. User inline styles still win via CSS cascade (appended last).getEmailThemingso the Link extension can resolve the active theme at render time.RESET_MINIMAL.linknow carriescolor: #0670DB+text-decoration: underlineso both themes ship a default link color.getResolvedNodeStylesagainst the active theme.Unblocks dropping the DOMParser workaround in the dashboard's
generate-json-content.ts(resend/resend#10044).Bug happening
CleanShot.2026-04-24.at.12.28.11.mp4
After this fix
CleanShot.2026-04-24.at.12.29.59.mp4
Test plan
packages/editor/src/extensions/link.spec.ts(6 cases): basic + minimal themes emit themed style,class="node-link"preserved, user color wins over theme,mark.attrs.stylestays empty for plain links (inspector contract), plain<a>setContent round-trip produces themed output.pnpm vitest run --project unit— 434 passed, 1 skipped, no snapshot regressions.pnpm buildclean.Summary by cubic
Make link rendering theme-aware by injecting EmailTheming styles into the
<a>tag during HTML export. Links render blue and underlined by default, and user inline styles still win.Bug Fixes
linkstyles into<a style>inrenderHTML; user inline styles are appended last to win.RESET_BASIC(color: #0670DB,text-decoration: underline);RESET_MINIMALreferences them for consistency.getResolvedNodeStyles; no hardcoded colors in the link extension.Dependencies
@react-email/editor.Written for commit 9af91a9. Summary will update on new commits.