Paragraph: Migrate to text-align block support#73111
Conversation
|
Size Change: +170 B (+0.01%) Total Size: 2.43 MB
ℹ️ View Unchanged
|
|
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. |
|
Flaky tests detected in ee74fe9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19199883956
|
ee74fe9 to
4a9d7c1
Compare
t-hamano
left a comment
There was a problem hiding this comment.
LGTM! Block transformation, block deprecation, and shortcut all work correctly.
| const sourceTextAlign = | ||
| attributes.textAlign || attributes.style?.typography?.textAlign; |
There was a problem hiding this comment.
At first glance, I thought that if the source block was a paragraph block, we should check attributes.align instead of attributes.textAlign, but it seems that the migration of the paragraph block has already been processed at this point.
|
One cool follow-up to this would be to allow "justify" but only at the global styles level. |
Part of #60763
Blocked by #62260
What
Migrates the Paragraph block to use the
textAlignblock support instead of a customalignattribute. As a consequence it also enables global styles support for textAlign for the paragraph block.Why?
The Paragraph block currently implements its own text alignment logic with a custom
alignattribute, duplicating code that should be handled by the centralizedtextAlignblock 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