fix(editor): preserve image styles when replacing an image - #3596
Conversation
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 detectedLatest commit: 51650a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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.
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
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5NmDNeo9mgSaDCVFzi2a2
There was a problem hiding this comment.
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
Dismissed because Cubic found issues in a newer review.
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/editorrelease.Bug Fixes
srcupdates (blob → uploaded URL).NodeSelectionand pass its attrs tosetImage; tests cover replace vs fresh insert inupload-flow.spec.ts.Refactors
upload-flow.ts.Written for commit 51650a1. Summary will update on new commits.