-
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
Block library: Standardize align and className attributes for dynamic blocks #14533
Conversation
These are just the dynamic blocks, right? I think standardizing these alignments is a great idea. I'm a big fan of allowing any content to be aligned any way. Here's my proposal, but I could be convinced otherwise.
|
Test post: <!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Archives</p>
<!-- /wp:paragraph -->
<!-- wp:archives {"align":"full"} /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Calendar</p>
<!-- /wp:paragraph -->
<!-- wp:calendar {"align":"full"} /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Categories</p>
<!-- /wp:paragraph -->
<!-- wp:categories {"align":"full"} /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Latest Comments</p>
<!-- /wp:paragraph -->
<!-- wp:latest-comments {"align":"full"} /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Latest Posts</p>
<!-- /wp:paragraph -->
<!-- wp:latest-posts {"align":"full"} /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Legacy Widget</p>
<!-- /wp:paragraph -->
<!-- wp:legacy-widget /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">RSS</p>
<!-- /wp:paragraph -->
<!-- wp:rss {"align":"full","feedURL":"https://gziolo.pl"} /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Search</p>
<!-- /wp:paragraph -->
<!-- wp:search {"align":"full"} /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Shortcode</p>
<!-- /wp:paragraph -->
<!-- wp:shortcode /-->
<!-- wp:paragraph {"textColor":"white","backgroundColor":"light-gray","fontSize":"small"} -->
<p class="has-text-color has-background has-small-font-size has-white-color has-light-gray-background-color">Tag Cloud</p>
<!-- /wp:paragraph -->
<!-- wp:tag-cloud {"align":"full"} /--> In the editor: On the frontend: |
cc0e234
to
d33b656
Compare
Yes, all of them have some rendering logic on the server. In your list I had only one concern:
I don't think it's technically possible as shortcodes are special. It's something lik
Agreed, both Shortcode and Legacy Widget exist for backward compatibility. We should leave them as they are. When testing changes applied, I noticed that those align options need some CSS on the frontend. I'm surprised we don't have a global handler which would make it simpler. It also looks like some padding is necessary to make full-width alignment look good for all updated blocks. I shared HTML code in the previous comment so you could play with it yourself and advice how to approach it. Feel free to apply changes yourself as well 😺 |
Yes, it appears the RSS & Search blocks don't get the I'm working on this right now. |
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.
Those last commits should fix the two blocks that wouldn't go full width. Now they all do. It doesn't look great on the frontend, but that's really where the themes come in, right?
If everything looks good, LGTM!
372b389
to
7da6f91
Compare
Yes, code changes look great, thanks for your help. In retrospect, I might at least tweak PHP part myself :) |
There is one failing test after I rebased this PR with
It looks like we need to land first PR which properly loads PHP files of blocks which are defined in WordPress core: #13521. |
a0ace23
to
4f76957
Compare
Okey, I rebased with |
…ok a bit more like the Latest Posts block.
…ame onto RSS block.
4f76957
to
fe1af92
Compare
Description
The current alignment of blocks:
left
,center
,right
wp-block-*
)left
,center
,right
,wide
,full
left
,center
,right
left
,center
,right
,wide
,full
left
,center
,right
,wide
,full
left
,center
,right
,wide
,full
How has this been tested?
Screenshots
Types of changes
Checklist: