Conversation
|
Size Change: -2.27 kB (0%) Total Size: 863 kB
ℹ️ View Unchanged
|
youknowriad
left a comment
There was a problem hiding this comment.
For the className automatically added to save, I've been wanting to remove the automatic addition for some time now to match edit and server. So might we can tie the removal of the magic addition with the lighterBlockWrapper opt-in behavior?
|
@youknowriad Yes, that sounds like a good idea. :) I was thinking it might be useful to have some sort of |
|
Something unrelated I'm wondering, why did you go with |
|
So that it could be passed to e.g. |
|
They could be seen as enhanced tags. :) |
| margin-left: auto; | ||
| margin-right: auto; | ||
|
|
||
| > .wp-block, |
There was a problem hiding this comment.
Because the max-width should apply to the align wrapper, but not the nested block
| } | ||
|
|
||
| &.wp-align-center { | ||
| // Same as no alignment? |
There was a problem hiding this comment.
this needs display: flex and justify-content center for me.
There was a problem hiding this comment.
you should be able to see the difference between "center" and "no" when you resize an image smaller than the $content-width
There was a problem hiding this comment.
display: flex has the unfortunate side effect of not collapsing margins. :) I'll figure it out though.
| { controls } | ||
| <AlignmentWrapper> | ||
| <BlockContentWrapper className={ classes }> | ||
| <div className={ `wp-align-wrapper wp-align-${ align }` }> |
There was a problem hiding this comment.
we're having wp-align-undefined sometimes
|
In my testing, floats are not working properly because it seems the width of the figure is always $content-size even if the image is small. (same for wide and full) |
|
Seems like the breakage is because of these editor styles https://developer.wordpress.org/block-editor/developers/themes/theme-support/#changing-the-width-of-the-editor We need to figure a new way for these? or appy the |
|
One potential solution is to extract the styles defining the widths from here https://github.com/WordPress/gutenberg/pull/20656/files#diff-556b1933de5650dc555c469c584accc2R116 and move them to another solution would be to rely on CSS variables (but maybe it's too soon for this) |
What's the behaviour for server? What do you envision for |
This would work, In the server we do nothing, we rely on the block author. |
|
So I've been thinking about this more and we have two possibilities I think: First approach To have the following styles in editor styles. Instead of asking theme authors to add this to their editor styles, we could potentially have a CSS transform to generate it from https://developer.wordpress.org/block-editor/developers/themes/theme-support/#changing-the-width-of-the-editor It's tricky though and there might be things we'll be missing. Second approach Apply the What's left is a CSS transform for editor styles to match I'm leaning towards the second approach with |
|
Closing this PR out as the original issue referenced has closed: If that's incorrect, feel free to reopen! |
Description
Explores ideas in #20650.
(As you can see in the screenshot above, the block outline and toolbar are positioned correctly without an exception to the rule.)
The idea:
Add an "alignment wrapper" around the block instead of inside the block content. This alignment wrapper can similarly be used to position floated images relative to the main column.
Here's what the editor DOM looks like:
As you can see it wraps around the block.
There are two ways to implement this:
editandsaveoutput when we detect block support for it.wp-block-*classes to the top level element returned bysave, which shouldn't be added to the wrapper.Benefits:
editandsaveoutput.How has this been tested?
Screenshots
Types of changes
Checklist: