-
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
Add full and wide
align controls to Query and Query Pagination blocks
#29289
Conversation
className: classnames( { | ||
'is-flex-container': hasLayoutFlex, | ||
[ `columns-${ columns }` ]: hasLayoutFlex, | ||
} ), | ||
} ); | ||
}; | ||
if ( align ) extraBlockProps[ 'data-align' ] = align; |
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.
why d we need this? Isn't it done automatically in the hooks?
if ( isset( $block->context['layout'] ) && isset( $block->context['query'] ) ) { | ||
if ( isset( $block->context['layout']['type'] ) && 'flex' === $block->context['layout']['type'] ) { | ||
$classnames = "is-flex-container columns-{$block->context['layout']['columns']}"; | ||
} | ||
} | ||
if ( isset( $block->context['align'] ) ) { | ||
$classnames .= " align{$block->context['align']}"; |
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.
Isn't this something that can be applied automatically by the the support flag?
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.
Check my comment about the attributes. This is what we had discussed about layout as well, so align goes to Query now.
Size Change: +103 B (0%) Total Size: 1.38 MB
ℹ️ View Unchanged
|
Agreed with the followup comment — we'd need to figure out what absorb in toolbar and passthrough mean in terms inner block properties. Making a wrapper be invisible or partially invisible (in the context of not affecting layout) is one of the oldest issues in #7694 |
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 have nothing to add to the code review.
The PR solves the problem described in the issue.
Full width and wide blocks inside a query loop appear with the correct widths inside the editor.
3a32bee
to
cf38730
Compare
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 looks OK to me, it just needs to be rebased before merging 👍
Thanks for reviewing!
Besides rebase and a small change to the selectors (not use |
PR has been merged so I assume this PR can be rebased and adjusted and then merged. |
Yes, it must be in combination with adding a wrapper for Query block. |
Closing in favor of: #30804 |
Description
Related: #27589
This PR adds
full and wide
align support toQuery/QueryLoop
andQuery Pagination
blocks.Ideally we would want to handle this with a mechanism for
absorbing
the toolbar of nested block wrappers as described in this issue: #7694.That's why I haven't used the
supports.align
inQueryLoop
and created an adhoc toolbar control foralign
inQuery
block. This is a UI choice for better user experience.How has this been tested?
Manually by adding
Query
andQuery Pagination
blocks and try different combinations ofalign
options.Checklist: