-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Media & Text: Replace the deprecated __experimentalImageSizeControl with ResolutionTool #57540
Conversation
Size Change: +155 B (+0.01%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
Move the media width control and update the "crop image to fill" label to better match the changes in #58447.
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. |
Remove the default value (true) from isShownByDefault in the ToolsPanelItem.
Import and apply the constants for the dropdownMenuProps that positions the popover for the options and reset panel.
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.
Thanks for the PR! I think it's working correctly overall. If you have any questions about comments I left, please feel free to ask 👍
Indent the ToolsPanelItem for the Focal Point one more tab stop.
The condition that was used to show or hide the Media width control was removed in a previous pull request, but this was missed when trying to solve merge conflicts.
Set the default value for mediaWidth in resetAll() to 50. Make sure that only values other than the default (50) counts as a change to the media with setting.
The option is enabled by default, so it should also reset to the enabled (true) state.
The reason why I have sort of paused the work on this PR is because the Alt is currently not working for the featured image, Both should be solved, I just don't want to cause more merge conflicts. |
As mentioned in this comment, there are some concerns with making alt text editable when "Use featured image" is enabled. I don't mind going either way, but since this PR doesn't add new features or fix bugs, I think it's okay to start with this one first. |
Sorry for the late feedback.
I noticed that this |
Yeah I think something just went wrong trying to solve one of the merge conflicts. |
I have updated the reset and the missing tools panel item but it is not ready for review yet. |
Well, I learnt that |
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.
LGTM!
- ✅ Items whose values have changed from their default values can be reset to their default values individually from the Settings option popover.
- ✅ Can return all values to their default values using the "Reset all" button in the Settings option popover.
- ✅ If "Use featured image" is enabled, the Resolution option will not be displayed.
Well, I learnt that
__experimentalImageSizeControl
is no longer deprecated: #56414
Which is the correct component to use?
I think it's fine as is. The __experimentalImageSizeControl
component might be deprecated again in the future and a warning may be issued. Instead, it may make more sense to unlock and use the ResolutionTool
component that is explicitly marked as private.
…ith ResolutionTool (WordPress#57540) Media & Text: Replace __experimentalImageSizeControl with ResolutionTool. Use the ToolsPanel and ToolsPanelItems, allowing settings to be reset. Co-authored-by: carolinan <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: richtabor <[email protected]>
What?
ImageSizeControl (__experimentalImageSizeControl) is used in the Media & text block. It was marked as deprecated in #51545.
This PR replaces __experimentalImageSizeControl with the ResolutionTool.
Partial for #52223
Why?
Deprecated controls should not be used.
How?
Adds a new tools panel and moves the existing block sidebar options to this panel.
Replaces __experimentalImageSizeControl with the ResolutionTool.
Testing Instructions
Testing Instructions for Keyboard
Deactivate Gutenberg.
Add two new media and text blocks with images. One with default options, one with the "Crop image to fill entire column" option enabled and a non default resolution.
Save.
Activate Gutenberg with the PR applied. Refresh the page and confirm that:
Save and view the front of the website. Confirm that the blocks display correctly, and the correct image size is loaded.
Screenshots or screencast
Before:
After: