-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Gallery: Refactor "Settings" panel of Gallery block to use ToolsPanel
instead of PanelBody
#67904
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
Gallery: Refactor "Settings" panel of Gallery block to use ToolsPanel
instead of PanelBody
#67904
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 PR is now ready to be reviewed. CC: @fabiankaegy |
Fixed failing unit tests for mobile. Credits: #67957 (review) |
Hi @Mamaduka, |
Sorry, @yogeshbhutkar! Somehow, I missed the ping. Do you mind rebasing this branch on top of the latest trunk? |
2e92776
to
c4eafe5
Compare
Thanks for taking a look, @Mamaduka. I’ve rebased the branch on the latest trunk. If possible, could we also include @Mayank-Tripathi32 in the props list for the efforts that went into #67957? |
@Mamaduka, the suggested changes have been implemented. When you have a moment, could you please review the PR again? |
e9b4558
to
5ef39b9
Compare
This comment was marked as outdated.
This comment was marked as outdated.
@yogeshbhutkar, I've noticed that the Gallery resolution is sometimes resettable, even for a freshly inserted block. Could be related to our previous conversation - #67904 (review). Besides that, everything looks good. Screenshot |
When I freshly inserted a block, I noticed, it's not the Ref: ref.movI was able to reproduce this on the latest Trunk as well, when either an image or cover block is inserted, the resolution remains resettable, even on fresh insertions. I see that in multiple places where we're handling images, we are defaulting the image sizes to Ref: gutenberg/packages/block-library/src/image/edit.js Lines 241 to 243 in c503fa3
However, the Image and Cover blocks use
cc: @Mamaduka |
Try selecting an image that has no "Large" size; anything below 1000px should work. The I think we need to make |
…size updates more effectively
… web and PanelBody for native
It's not required to check if sizeSlug exists within imageSizeOptions, as the user would make the selection from within imageSizeOptions itself.
Apart from setting the sizeSlug attribute, the inner blocks must be updated on "resetAll" as well
* When resetting all, don't reset linkTo as it's not controlled by ToolsPanel * Whenever inner blocks are also going to be updated, like for sizeSlug and linkTarget, use the dedicated function within resetAll instead of just setting them to undefined
* Resolution control and loading indicator are rendered in different places. * Resolution control loads instantly when the block is selected, even on slow networks.
25fe5e6
to
92ae92d
Compare
@@ -4,3 +4,4 @@ export const LINK_DESTINATION_LIGHTBOX = 'lightbox'; | |||
export const LINK_DESTINATION_ATTACHMENT = 'attachment'; | |||
export const LINK_DESTINATION_MEDIA_WP_CORE = 'file'; | |||
export const LINK_DESTINATION_ATTACHMENT_WP_CORE = 'post'; | |||
export const DEFAULT_MEDIA_SIZE_SLUG = 'large'; |
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 should ideally be set to full
to match the defaults corresponding to the Image
block; currently, this is synced with the default provided within the block.json for the Gallery
block.
I tried updating all such defaults, but, ideally, a deprecation object should be created, and certain fixtures/snapshots should be updated, which felt out of scope for this PR. I believe it's best implemented as a follow-up.
@Mamaduka, the reset
bug mentioned here should now be fixed. Could you give this another test?
P.S. The failing test seems unrelated.
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.
I tried updating all such defaults, but, ideally, a deprecation object should be created, and certain fixtures/snapshots should be updated, which felt out of scope for this PR. I believe it's best implemented as a follow-up.
I don't think it's worth yet another block deprecation. Additionally, defaulting to the full-size images in the Gallery block can have a negative impact on performance. Let's keep large
as the default here.
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 bringing this over the finish line, @yogeshbhutkar!
Fixes: #67893
What?
This PR introduces the usage of
ToolsPanel
instead ofPanelBody
inside theSettings
panel ofGallery
Block.Why?
This PR is a part of #67813 which standardizes the usage of
ToolsPanel
insideBlock Inspector Settings
How?
PanelBody
is replaced with the correspondingToolsPanel
component.Testing Instructions
ToolsPanel
component.Screencast
Screen.Recording.2024-12-13.at.1.04.16.PM.mov