Skip to content

fix(editor): preserve image styles when replacing an image#3596

Draft
danilowoz wants to merge 1 commit into
canaryfrom
claude/slack-session-scck2d
Draft

fix(editor): preserve image styles when replacing an image#3596
danilowoz wants to merge 1 commit into
canaryfrom
claude/slack-session-scck2d

Conversation

@danilowoz

@danilowoz danilowoz commented Jun 24, 2026

Copy link
Copy Markdown
Member

When replacing a selected image via the uploadImage command, carry over the existing image node's attributes (style/border-radius, width, height, alignment, href, alt) instead of resetting them to defaults. Only the src is overridden with the new blob URL. Paste/drop/slash-insert of a brand-new image (no image selected) is unaffected.

Adds a focused upload-flow.spec.ts covering both the replace (attrs preserved) and fresh-insert (no carry-over) paths.

Claude-Session: https://claude.ai/code/session_01D5NmDNeo9mgSaDCVFzi2a2


Summary by cubic

Preserves existing image styling and metadata when replacing a selected image via upload. Only the image source changes; paste/drop/slash-insert of new images is unchanged.

  • Bug Fixes
    • Carry over style, width, height, alignment, href, and alt when replacing a selected image; only src is updated (blob → uploaded URL).
    • Detect selected image with NodeSelection and pass its attrs to setImage.
    • Added upload-flow.spec.ts tests for replace (attrs preserved) and fresh insert (no carry-over).

Written for commit 028563e. Summary will update on new commits.

Review in cubic

When replacing a selected image via the uploadImage command, carry over
the existing image node's attributes (style/border-radius, width, height,
alignment, href, alt) instead of resetting them to defaults. Only the src
is overridden with the new blob URL. Paste/drop/slash-insert of a brand-new
image (no image selected) is unaffected.

Adds a focused upload-flow.spec.ts covering both the replace (attrs
preserved) and fresh-insert (no carry-over) paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5NmDNeo9mgSaDCVFzi2a2
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 028563e

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

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
react-email Ready Ready Preview, Comment Jun 24, 2026 12:21am
react-email-demo Ready Ready Preview, Comment Jun 24, 2026 12:21am

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 028563e

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

Copy link
Copy Markdown
Contributor

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.

Requires human review: Changes affect core editor logic for image upload/replacement, including state management via NodeSelection. A bug here could corrupt user content by incorrectly applying attributes. This requires domain knowledge of the editor's attribute handling and should be reviewed by a human.

Re-trigger cubic

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.

2 participants