-
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
Fix upload button on overridden empty image block in patterns #59169
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/compat/wordpress-6.5/blocks.php |
Size Change: +7 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Flaky tests detected in 6a8ceb0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7956496741
|
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.
This tests well for me @kevin940726 👌
In early explorations (#53887) I found the id
needed to be tracked as well to make sure when replacing an image via the media library, the correct original selection was shown.
I can replicate that issue of the missing image selection in the media library on trunk and confirm that this PR fixes it as well.
✅ Upload button is no longer incorrectly shown
✅ Crop button now displays correctly
✅ Image selection within media library is now correct
Before | After |
---|---|
@SantosGuillamot @gziolo @michalczaplinski @artemiomorales Just a heads up that this adds the image block's |
Co-authored-by: kevin940726 <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: talldan <[email protected]>
I just cherry-picked this PR to the cherry-pick-beta-2 branch to get it included in the next release: 4fcb480 |
Co-authored-by: kevin940726 <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: talldan <[email protected]>
@@ -31,6 +31,7 @@ export const PARTIAL_SYNCING_SUPPORTED_BLOCKS = { | |||
rel: __( 'Link Relationship' ), | |||
}, | |||
'core/image': { | |||
id: __( 'Image ID' ), |
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.
There is a note in the code:
// TODO: This should not be hardcoded. Maybe there should be a config and/or an UI.
@talldan and @SantosGuillamot, I contemplated the other day whether we should add labels to block attributes schema and annotate them as translatable in block.json
. That could also be considered as one of the conditions to opt into block bindings in the future.
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.
By the way, I think you should use _x()
with the context so it's easier to translate these labels.
gutenberg/packages/blocks/src/api/registration.js
Lines 271 to 274 in a04a8e9
if ( typeof i18nSchema === 'string' && typeof settingValue === 'string' ) { | |
// eslint-disable-next-line @wordpress/i18n-no-variables, @wordpress/i18n-text-domain | |
return _x( settingValue, i18nSchema, textdomain ); | |
} |
The context could be similar to:
"label": "block style label" |
block attribute label
could work. That simpler part might make sense to update still before WP 6.5 beta 3.
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.
Yeah, I always have some doubts about including the translation strings here. Currently, they are not used in any way but are still kept. Should we just remove them for this release to not cause confusion for translators?
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.
Let's remove them to prevent unnecessary work for translators. 16 most popular locales need to have 100% coverage before the major release starts 😅
What?
Fix #58708.
Fix the confusing upload button on the block toolbar for overridden empty image in patterns.
Why?
The upload button is confusing and it creates bad UX.
How?
Add
id
as a binding attribute for the image block as well.Testing Instructions
Follow the testing instructions in #58708.
Also added an e2e test.
Screenshots or screencast
N/A