mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-30 00:27:43 +09:00
## Description Adds the ability to replace an existing image asset with a new file directly from the asset details panel, without having to delete and re-upload manually. Related to [place an image so that it gets replaced automatically everywhere its being used #3268](https://github.com/webstudio-is/webstudio/issues/3268) When clicking the new replace button on an image asset: 1. A file picker opens filtered to image MIME types 2. The new file is uploaded via the existing upload pipeline 3. All references to the old asset (props, styles, page meta: favicon, social image, marketplace thumbnail) are atomically re-pointed to the new asset 4. The old asset's filename and description are copied to the new asset 5. The old asset is deleted A new `ReverseIcon` from the Figma library was added to the icons package to represent the replace action. ## Steps for reproduction 1. Open the asset manager and select any image asset 2. In the asset details panel, click the new replace icon button next to the download button 3. Select a new image file from the file picker 4. Expect the asset to be replaced in place - all usages (image props, background styles, favicon, social image) should now reference the new file with the original asset's filename preserved ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [x] made a self-review - [x] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [x] tested locally and on preview environment (preview dev login: 0000) - [x] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [x] added tests - [ ] if any new env variables are added, added them to `.env` file