feat(ui): also preview HTML email templates#3526
Conversation
Signed-off-by: gabriel miranda <gabriel@resend.com>
Signed-off-by: gabriel miranda <gabriel@resend.com>
Signed-off-by: gabriel miranda <gabriel@resend.com>
Signed-off-by: gabriel miranda <gabriel@resend.com>
🦋 Changeset detectedLatest commit: 5c5fe84 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
There was a problem hiding this comment.
2 issues found across 13 files
Confidence score: 2/5
packages/ui/src/actions/render-email-by-path.tsxintroduces a meaningful security risk: raw template HTML is passed toiframe.srcDoc, so embedded<script>can execute with same-origin access to the preview app.packages/ui/src/components/toolbar.tsxhas a concrete UX regression risk where staletoolbar-panel=compatibilitycan leave users on a hidden tab and make reload appear broken.- The severity/confidence mix (7/10 and 5/10, both with solid confidence) points to high merge risk until these behaviors are addressed.
- Pay close attention to
packages/ui/src/actions/render-email-by-path.tsx,packages/ui/src/components/toolbar.tsx- isolate raw HTML preview execution context and clear stale compatibility panel state for raw HTML emails.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Signed-off-by: gabriel miranda <gabriel@resend.com>
Signed-off-by: gabriel miranda <gabriel@resend.com>
There was a problem hiding this comment.
2 issues found across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Auto-approved: This PR adds support for previewing raw HTML email templates in a well-contained manner, branching only on file extension and leaving existing .tsx/.jsx preview logic untouched, with thorough tests and error handling.
Re-trigger cubic
this does not include compatibility checking for those same templates. this should not be such a hard follow up, though, but I think it better to do that separately.
Summary by cubic
Add support for previewing raw
.htmlemail templates in@react-email/ui. HTML files render without React, show formatted HTML and plain text, and load in a sandboxed iframe that blocks scripts while allowing safe popups..htmlemails and resolve slugs to.htmlpaths..htmldirectly: format withreact-email’spretty, generate plain text withtoPlainText, and cache results.htmltab, show only HTML/Markdown tabs, coercetsxURL state tohtml, use pretty markup in the code panel, and sandbox the iframe withallow-same-origin allow-popups allow-popups-to-escape-sandbox..html, update “Copy for AI” to label and fence as HTML, and switch the toolbar panel to Linter when navigating from a JSX/TSX email to.html..htmlin the playground.Written for commit 5c5fe84. Summary will update on new commits. Review in cubic