Site Title : Migrate to Text-Align Block Support#75551
Conversation
|
Size Change: +62 B (0%) Total Size: 6.84 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 1f64229. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22034306270
|
|
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 If 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. |
| type: 'block', | ||
| blocks: [ 'core/site-title' ], | ||
| transform: ( { isLink, linkTarget } ) => { | ||
| transform: ( { isLink, linkTarget, style } ) => { |
There was a problem hiding this comment.
I don't think the Site Logo block supports textAlign in the first place.
| <!-- wp:site-title {"level":2,"style":{"typography":{"textAlign":"left"}}} /--> | ||
|
|
||
| <!-- wp:site-title {"level":2,"style":{"typography":{"textAlign":"center"}}} /--> | ||
|
|
||
| <!-- wp:site-title {"level":2,"style":{"typography":{"textAlign":"right"}}} /--> |
There was a problem hiding this comment.
This is odd. The heading level of the Site Title block is 1 by default, so why is it being transformed to 2?
1f64229 to
d5ebc25
Compare
|
I have fixed test data issue and also reverted |
| const blockProps = useBlockProps( { | ||
| className: clsx( { | ||
| [ `has-text-align-${ textAlign }` ]: textAlign, | ||
| 'wp-block-site-title__placeholder': ! canUserEdit && ! title, |
There was a problem hiding this comment.
Same as the feedback here. The wp-block-site-title__placeholder class cannot be deleted.
const blockProps = useBlockProps( {
className:
! canUserEdit && ! title && 'wp-block-site-title__placeholder',
} );8d33655 to
c3d365d
Compare
|
I have added missing class in |
What?
Part of #60763
Migrates the
Site Titleblock to use the textAlign block support instead of a customtextAlignattribute. As a consequence it also enables global styles support fortextAlignfor theSite Title.Why?
The
Site Titleblock currently implements its own text alignment logic with a custom align attribute, duplicating code that should be handled by the centralizedSite Titleblock support. This migration reduces code duplication and consolidates alignment handling across blocks.How?
Replaces the custom logic with the block supports, adds deprecation and fixes transforms.
Testing Instructions
Site Titleblock and test text alignment (left, center, right)Site Titleblocks that have alignment set