Skip to content

feat(editor): new Container EmailNode#3137

Open
gabrielmfern wants to merge 5 commits intocanaryfrom
feat/container-extension
Open

feat(editor): new Container EmailNode#3137
gabrielmfern wants to merge 5 commits intocanaryfrom
feat/container-extension

Conversation

@gabrielmfern
Copy link
Copy Markdown
Member

@gabrielmfern gabrielmfern commented Mar 30, 2026

The base template had a container, but the editor's view didn't when using this package normally, and the dashboard does because it does it manually. To fix this we could either make a new Editor component, or make it into an extension.

To move it to an extension it auto inserts itself into the Editor's content on creation. It then defines its own node view that can then be styles through the injected CSS from EmailTheming, and for the email template through composeReactEmail without having to provide an Editor component to the user.

It also used two <Section>s to do (from my understanding) what the <Container> component already does, so it also replaces that.


Summary by cubic

Adds a container EmailNode that auto-wraps editor content in a centered, max‑width container and renders to email with @react-email/components Container. It keeps globalContent at the root and works for new and existing docs.

  • New Features

    • Added container node to StarterKit with a ProseMirror plugin that ensures one container exists and auto‑wraps content while keeping globalContent top‑level.
    • Renders to email with Container (width: 100%, maxWidth from styles) and to the editor as <div class="node-container" data-type="container">.
  • Refactors

    • Removed container wrappers from the default base template and theming BaseTemplate; <Body> now directly renders children with body styles.
    • Theming adds container to the component key and reset types so container styles resolve through the node.

Written for commit 7cd127f. Summary will update on new commits.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 30, 2026

⚠️ No Changeset found

Latest commit: 7cd127f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-email Ready Ready Preview, Comment Mar 31, 2026 0:09am
react-email-demo Ready Ready Preview, Comment Mar 31, 2026 0:09am
react-email-examples Ready Ready Preview, Comment Mar 31, 2026 0:09am

Request Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 30, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@react-email/editor@3137

commit: 127667d

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@gabrielmfern gabrielmfern changed the title feat(editor): add Container EmailNode extension feat(editor): container EmailNode extension Mar 30, 2026
@gabrielmfern gabrielmfern force-pushed the feat/container-extension branch from 6716022 to 6844cce Compare March 30, 2026 17:27
@gabrielmfern gabrielmfern force-pushed the feat/container-extension branch from 6844cce to fd35809 Compare March 30, 2026 19:38
@gabrielmfern gabrielmfern requested a review from joaopcm March 30, 2026 20:04
@gabrielmfern gabrielmfern marked this pull request as ready for review March 30, 2026 20:04
@gabrielmfern gabrielmfern changed the title feat(editor): container EmailNode extension feat(editor): new Container EmailNode Mar 30, 2026
Adds a Container extension that auto-wraps editor content in a
centered, max-width container. It renders as <Container> from
@react-email/components during email serialization and as a styled
<div class="node-container"> in the editor view. A ProseMirror plugin
ensures the container is always present, handling both fresh editors
and migration of existing documents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gabrielmfern and others added 4 commits March 31, 2026 09:08
Remove the hardcoded <Container> wrapper from EmailTheming's
BaseTemplate and the default template — the Container node's
renderToReactEmail now handles it. Also wires up style resolution
by adding 'container' to getThemeComponentKey and RESET_NODE_TYPES.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant