-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image: Reflect media deletion in the editor #35973
Image: Reflect media deletion in the editor #35973
Conversation
Size Change: +165 B (0%) Total Size: 1.11 MB
ℹ️ View Unchanged
|
9151d39
to
884697f
Compare
8acf54e
to
bb3b296
Compare
bb3b296
to
b41f862
Compare
…on and passing to onRemove prop.
Now relying on the `onClose` event of the media upload, and the media object to test if the media has been "destroyed."
This removes the `isSelected` check, but also removes a bunch of code as well. We could run the same check on `isSelected`... TBC
… added to the Image props
b41f862
to
5410b0b
Compare
Will do! It would be great to get it tested by someone who is not me too. 🍺 |
Thanks for the nudge on this one @glendaviesnz Seems actually to be a nice little upgrade Kapture.2021-12-14.at.13.39.44.mp4 |
This tests well for me - this seems like a pretty robust fix for the single image deletion, and a One last question at this point - should we be assuming that on deleting the image the user also expects the |
Good question. I didn't consider that angle 🤔, and assumed that metadata should also be deleted with the image. I was taking the lead from the way we already clear the attributes if we can't find the media properties. I can imagine that one might delete the image and select another one at the same time. Looking at it that way, it could be annoying to have the data wiped. What do you reckon? |
I imagine that 50% of users will want the data to stay and 50% for it to be cleared 😄 Maybe, given that it is easier to highlight and overwrite text you thought should have been wiped than to remember and rewrite the text you had hoped would stay, we start with keeping it? |
… That way the caption, title and alt values persist in case the user deletes, then replaces.
Ha! Too easy. I've also updated the test description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well for me 🎉
I added the Backport label as I assume this will be backported to WP 5.9. |
@paaljoachim could you clarify why this needs to be backported to 5.9? At this stage in the release process, we should only backport regressions and fixes to the new features going into this release e.g. site editor, global styles and navigation block. |
Hi @tellthemachines I removed the Backport label. |
…eleted from the attachments. If the image block was not replaced with an embed, and it's not an external image, and it's been deleted from the database, clear the attributes and trigger the placeholder.
…eleted from the attachments. If the image block was not replaced with an embed, and it's not an external image, and it's been deleted from the database, clear the attributes and trigger the placeholder.
…eleted from the attachments. If the image block was not replaced with an embed, and it's not an external image, and it's been deleted from the database, clear the attributes and trigger the placeholder.
Description
Looking at fixes for #23262
It should close #28914 as well.
Very rough start.
So far we're:
new Image()
How to test
Repeat steps 1-7 but add multiple images, including the new Gallery block (with Image InnerBlocks), ensuring that the same image appears multiple times in your post.
To test that image embed replacement still works, insert a new Image Block and use an url from an image service, e.g., https://www.flickr.com/photos/normanwest4tography/51737773160/in/explore-2021-12-11/
See Embeds for a list of embeddable image sources.
Repeat steps 1-7, but at step 3, after you've deleted the image, select another image to replace the deleted one. If you've added a caption, the caption should persist.
Screenshots
Nov-16-2021.20-37-30.mp4
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).