Skip to content

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

Merged
danilowoz merged 3 commits into
canaryfrom
claude/slack-session-scck2d
Jun 30, 2026
Merged

fix(editor): preserve image styles when replacing an image#3596
danilowoz merged 3 commits 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 and paste/drop/slash-insert of new images is unchanged. Adds a changeset for a minor @react-email/editor release.

  • Bug Fixes

    • Preserve style, width, height, alignment, href, and alt when replacing a selected image; only src updates (blob → uploaded URL).
    • Detect selected image with NodeSelection and pass its attrs to setImage; tests cover replace vs fresh insert in upload-flow.spec.ts.
  • Refactors

    • Removed unnecessary comments in upload-flow.ts.

Written for commit 51650a1. 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

🦋 Changeset detected

Latest commit: 51650a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@react-email/editor Minor

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

@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 30, 2026 9:23am
react-email-demo Ready Ready Preview, Comment Jun 30, 2026 9:23am

@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: 51650a1

@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

@danilowoz
danilowoz marked this pull request as ready for review June 29, 2026 09:49
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5NmDNeo9mgSaDCVFzi2a2
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Jun 29, 2026

@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.

0 issues found across 2 files (changes from recent commits).

Re-trigger cubic

@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.

1 issue found across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread .changeset/tricky-planets-cry.md
@cubic-dev-ai
cubic-dev-ai Bot dismissed their stale review June 30, 2026 09:26

Dismissed because Cubic found issues in a newer review.

@danilowoz
danilowoz merged commit b897235 into canary Jun 30, 2026
19 of 20 checks passed
@danilowoz
danilowoz deleted the claude/slack-session-scck2d branch June 30, 2026 10:37
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