WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.53k stars 4.21k forks source link

Image: Preserve caption toggle state when replacing image in image block #67101

Open Infinite-Null opened 3 days ago

Infinite-Null commented 3 days ago

Fixes: #66979

What?

When replacing an image block with a Media Library image that has a caption, the caption toggle state is now preserved instead of being automatically enabled. This fixes unexpected behavior in Block Patterns where captionless images would suddenly display captions after replacement.

Why?

Currently, when replacing an Image Block that has captions disabled with an image from the Media Library that has a caption, the Block Editor unexpectedly toggles on the caption setting.

Screencast:

Before Fix:

https://github.com/user-attachments/assets/d19e5d4d-e4c0-4efa-b589-bee495428824

After Fix:

https://github.com/user-attachments/assets/87372e78-d7d1-4790-bb3d-c09001476846

github-actions[bot] commented 3 days ago

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

github-actions[bot] commented 3 days ago

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

github-actions[bot] commented 3 days ago

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

github-actions[bot] commented 3 days ago

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.