-
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
useOnBlockDrop: Fix the Gallery block check #58711
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 Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf 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. |
@@ -292,7 +295,8 @@ export default function useOnBlockDrop( | |||
{ | |||
layout: { | |||
type: 'flex', | |||
flexWrap: areAllImages ? null : 'nowrap', | |||
flexWrap: | |||
areAllImages && galleryBlock ? null : 'nowrap', |
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 believe we only want to set null
for the gallery block.
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.
Yes, I believe that's correct.
Size Change: 0 B Total Size: 1.69 MB ℹ️ View Unchanged
|
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.
Good catch, thanks for fixing this up @Mamaduka! Also, good to know that canInsertBlockType
is the right check for this rather than just whether or not the Gallery block is registered 👍
✅ Confirmed that on trunk
with the Gallery block disabled in preferences, the drag to the left / right behaviour resulted in nothing happening
✅ With this PR applied, if the Gallery block is disabled, then a Row
block with nowrap
is what gets used instead:
LGTM! ✨
@@ -292,7 +295,8 @@ export default function useOnBlockDrop( | |||
{ | |||
layout: { | |||
type: 'flex', | |||
flexWrap: areAllImages ? null : 'nowrap', | |||
flexWrap: | |||
areAllImages && galleryBlock ? null : 'nowrap', |
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.
Yes, I believe that's correct.
Thanks for the testing/review, @andrewserong 🙇 |
What?
This is a follow-up to #56186.
PR swaps block type existence check with
canInsertBlockType
.Why?
There are multiple ways to disable block type; the
canInsertBlockType
is the correct selector for this check.Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2024-02-06.at.08.19.44.mp4