fix: preserve styles on drag/drop and paste image replace#64
Closed
boraoztunc wants to merge 1 commit intoKartikLabhshetwar:mainfrom
Closed
fix: preserve styles on drag/drop and paste image replace#64boraoztunc wants to merge 1 commit intoKartikLabhshetwar:mainfrom
boraoztunc wants to merge 1 commit intoKartikLabhshetwar:mainfrom
Conversation
- Add replaceImage store action — swaps URL/name only, all styles untouched
- Intercept window drag/drop and document paste globally in EditorCanvas
when an image is loaded, preventing the browser from opening files in a
new tab and preserving all applied styles on swap
- Show drop overlay ("Drop to replace image / Your styles will be preserved")
while a file is being dragged over the canvas
- Simplify getR2PublicUrl to always return the same-origin /r2-assets/ proxy
path; missing env var now fails gracefully via onError rather than crashing
- Add .claude/ to .gitignore to keep local Claude Code settings out of VCS
- Add CLAUDE.md with project context for contributors using Claude Code
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@boraoztunc is attempting to deploy a commit to the vercel oss program Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
Hey @KartikLabhshetwar let me know what do you think of this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a UX bug where dragging or pasting a new image onto the canvas after the first upload would open it in the browser's new tab instead of swapping it in the editor.
Changes
lib/store/index.ts— newreplaceImageaction that swaps the image URL/name only, leaving all applied styles (shadow, border, background, 3D, overlays, etc.) completely untouchedcomponents/canvas/EditorCanvas.tsx— globaldragover/dragleave/dropanddocument pastelisteners active only while an image is loaded; listeners are cleaned up on unmountcomponents/canvas/EditorCanvas.tsx— drop overlay UI showing "Drop to replace image / Your styles will be preserved" while a file is being dragged over the canvaslib/r2.ts— simplifiedgetR2PublicUrlto always return the same-origin/r2-assets/proxy path; missingNEXT_PUBLIC_R2_PUBLIC_URLenv var now fails gracefully viaonErrorrather than crashing.gitignore— added.claude/to keep local Claude Code settings out of version controlCLAUDE.md— added project context file for contributors using Claude CodeType of Change
replaceImagestore action)Testing
Checklist