-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Featured Image: Fix available options in resolution selector according to theme support #70632
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
base: trunk
Are you sure you want to change the base?
Featured Image: Fix available options in resolution selector according to theme support #70632
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. |
@@ -46,7 +46,7 @@ import { unlock } from '../lock-unlock'; | |||
|
|||
const ALLOWED_MEDIA_TYPES = [ 'image' ]; | |||
const { ResolutionTool } = unlock( blockEditorPrivateApis ); | |||
const DEFAULT_MEDIA_SIZE_SLUG = 'full'; | |||
const DEFAULT_MEDIA_SIZE_SLUG = 'post-thumbnail'; |
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.
Instead post-thumbnail
we should update default value in server-side
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.
From my understanding, post-thumbnail
was set to be default in the block's render.php
as it was the default behavior before the option to choose resolution was added
Ref: #38044 (comment)
So won't it be better to leave the fallback behavior as it is & instead change the displayed value in editor to reflect actual behavior...?
post-thumbnail
Updated the implementation according to #70526 (comment) Only difference from the comment being using empty strings instead of This was done because When theme supports ![]() When theme doesn't support ![]() The highlighted ones are the default options, having value as |
…-thumbnail size availability
What?
Closes #70526
This PR changes the default select dropdown value of featured image size to be
post-thumbnail
instead offull
to reflect the default behavior on frontendWhy?
By default, when we add featured image block it doesn't include the
sizeSlug
attribute in the generated markupHence, the block uses the fallback value of
post-thumbnail
in the frontendgutenberg/packages/block-library/src/post-featured-image/index.php
Line 25 in c55f216
However, the select dropdown in the editor shows
Full
as the default size, there is a difference in rendered image in frontend with the default value vs explicitly selectedFull
size as shown in #70526This PR just changes the initially displayed dropdown value when adding featured image & doesn't affect the size used in frontend
How?
This PR modifies the value of
DEFAULT_MEDIA_SIZE_SLUG
constant to bepost-thumbnail
according to default behavior instead offull
used beforegutenberg/packages/block-library/src/post-featured-image/edit.js
Line 49 in c55f216
Testing Instructions
Resolution
value under block settings