Refactor Buttons block to use JustifyToolbar controls#28768
Conversation
|
Size Change: -329 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
|
This is working well for me: Also for vertical:
I suspect if #28485 lands, that these issues will go away for you. |
|
Thanks Joen, I rebased to pick up the changes in #28485 and confirmed it all works for me. |
bc8e45e to
82b4b55
Compare
gwwar
left a comment
There was a problem hiding this comment.
Nice, this tests pretty well to me and I verified serialized button output/and that the blocks load again without issues.
Center:
<!-- wp:buttons {"contentJustification":"center"} -->
<div class="wp-block-buttons is-content-justification-center"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link">Hello World</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
Left
<!-- wp:buttons {"contentJustification":"left"} -->
<div class="wp-block-buttons is-content-justification-left"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link">Hello World</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
Right
<!-- wp:buttons {"contentJustification":"right"} -->
<div class="wp-block-buttons is-content-justification-right"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link">Hello World</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
One thing I did notice that could be left as a follow up, is that the justification controls can run away from you, to the left, when adjusting from justify-right. This is more noticeable when buttons is set to full width.


Description
Updates the Buttons block to use the new Justify Toolbar controls introduced in #28439
How has this been tested?
Types of changes
Code refactoring to use same control, there should be no visible changes.
NOTE: This is not quite working right for horizontal for some difference in CSS that I'm missing.
@jasmussen can you try it out, the vertical variant works as expected. The horizontal does not seem to work for left and center, but does for right. There is something in CSS that I'm missing.
There is an additional file
content-justification-dropdown.jsthat is still used foredit.native.js- I could update but I'm not sure how to test mobile properly. We can also follow with a mobile refactor.