fix(editor): emit theme link styles in renderHTML
Merged
JO
6mo ago+171+171+012345678901234567890123456789-3-3-0123456789
Summary
- Link mark renderHTML merges EmailTheming link styles into the emitted
<a style="...">. User inline styles still win via CSS cascade (appended last). - Exports
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.- No hardcoded colors in link.tsx; all defaults come from
getResolvedNodeStylesagainst the active theme.
Unblocks dropping the DOMParser workaround in the dashboard's generate-json-content.ts (resend/resend#10044).
Bug happening
https://github.com/user-attachments/assets/16daba0c-2a5d-42f1-83e2-642632845cff
After this fix
https://github.com/user-attachments/assets/f16e01c0-46fa-48b9-8225-ed6bf06fc640
Test plan
- New
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. - Manual: dashboard Visual -> HTML -> Visual, add link in Visual mode, confirm blue + underline in editor view and in exported HTML.
- Manual: switch theme to minimal, confirm link still themed.
- Manual: set custom link color via inspector, confirm custom color wins in both editor and export.
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
- Merge theme
linkstyles into<a style>inrenderHTML; user inline styles are appended last to win. - Move default link styles to
RESET_BASIC(color: #0670DB,text-decoration: underline);RESET_MINIMALreferences them for consistency. - Resolve defaults via
getResolvedNodeStyles; no hardcoded colors in the link extension. - Fixes link styling loss on Visual ↔ HTML round‑trips; enables removing the DOMParser workaround in the dashboard.
- Merge theme
-
Dependencies
- Add changeset for a patch release of
@react-email/editor.
- Add changeset for a patch release of