#39457: Image block keep image size on replacing image #49982
Merged
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.
What?
This PR fixes #39457 to keep the selected size in an image block when replacing/changing the image.
This is a follow up PR to #44522 where I couldn't get the PR correctly to rebase on trunk.
Why?
Useful for patterns where a certain image size is required for it to look good. A pattern can declare the sizeSlug attribute and it will try to insert the new image in the size again.
How?
Previously on selecting a new image there was a check if the new image is available in the default image size, if yes it used that and if not it falled back to "full". Now it checks for a previously selected sizeSlug attribute and checks if the image is available in that size, if not it does the same checks as before (default size, full). So the order is:
Testing Instructions
Test with images that have the selected size
Test with images that don't have the selected size (eg are smaller):
Testing Instructions for Keyboard
Screenshots or screencast