Skip to content

fix: treat paragraphs with inline leaf nodes as non-empty#3213

Draft
bukinoshita wants to merge 1 commit intocanaryfrom
fix/empty-state-hardbreak-ef77
Draft

fix: treat paragraphs with inline leaf nodes as non-empty#3213
bukinoshita wants to merge 1 commit intocanaryfrom
fix/empty-state-hardbreak-ef77

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Fixes editor empty-state detection by treating paragraphs with inline leaf nodes (e.g., hardBreak) as non-empty. Prevents placeholders or disabled actions when the document only has visible line breaks. Resolves BU-669.

  • Bug Fixes
    • Updated isEmptyParagraph to use node.childCount === 0 instead of node.textContent.length === 0 (ProseMirror textContent ignores inline leaf nodes).
    • Added tests for paragraphs with hardBreak (alone, with text, inside container); isEditorEmpty now stays false when visible breaks exist.

Written for commit 0874255. Summary will update on new commits.

…empty

Change isEmptyParagraph to check node.childCount === 0 instead of
node.textContent.length === 0. ProseMirror's textContent ignores
inline leaf nodes like hardBreak, causing paragraphs containing only
a hardBreak to be incorrectly classified as empty.

Resolves BU-669

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 9, 2026

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

Project Deployment Actions Updated (UTC)
react-email Ready Ready Preview, Comment Apr 9, 2026 5:25pm
react-email-demo Ready Ready Preview, Comment Apr 9, 2026 5:25pm
react-email-examples Ready Ready Preview, Comment Apr 9, 2026 5:25pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 9, 2026

⚠️ No Changeset found

Latest commit: 0874255

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

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 2 files

Confidence score: 5/5

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 9, 2026

Open in StackBlitz

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

commit: 0874255

@cursor cursor bot changed the title fix(editor): Treat paragraphs with inline leaf nodes as non-empty fix: treat paragraphs with inline leaf nodes as non-empty Apr 9, 2026
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.

3 participants