-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Refactor Heading block to use class names for text align #16035
Conversation
f87915e
to
dffab8b
Compare
04d9423
to
8a464f4
Compare
just leaving a note that I tested this out locally, and it resolved a few issues I had with block styles, good work! 👍 |
I'm rather leaning towards moving it back to the sidebar to land the changes related to text alignment first and then replicate it for other core blocks in a follow-up PR. |
I think it makes sense. It would help for reviews. |
8a464f4
to
2f0a325
Compare
Removed with 2f0a325. |
Is this a change that is going to be applied to all blocks? Thinking about consistency? Also, if it's the case, are we considered about the deprecations needed (especially the paragraph block), this might create a big number of warnings :) |
Yes, there are 3 more blocks to update:
We are going to add it to List block as well.
This will trigger in case non-default text alignment is applied. We should rather make those warning less scary when block's HTML get properly updated to use the latest version :) |
Agreed, I think we can entirely avoid the warning and maybe just write a friendly notice. |
…rnmobile/open-video-by-browser-for-android * 'master' of https://github.com/WordPress/gutenberg: (34 commits) [RNMobile] Native mobile release v1.7.0 (#16156) Scripts: Document and simplify changing file entry and output of build scripts (#15982) Block library: Refactor Heading block to use class names for text align (#16035) Make calendar block resilient against editor module not being present (#16161) Bump plugin version to 5.9.1 Editor: Fix the issue where statics for deprecated components were not hoisted (#16152) Build Tooling: Use "full" `npm install` for Build Artifacts Travis task (#16166) Scripts: Fix naming conventions for function containing CLI keyword (#16091) Add native support for Inserter (Ported from gutenberg-mobile) (#16114) docs(components/higher-order/with-spoken-messages): fix issue in example code (#16144) docs(components/with-focus-return): fix typo in README.md (#16143) docs(block-editor/components/inspector-controls): fix image path in README.md (#16145) Add mention of on Figma to CONTRIBUTING.md (#16140) Bring greater consistency to placeholder text for media blocks. (#16135) Add descriptive text and a link to embed documentation in embed blocks (#16101) Update toolbar-text.png (#16102) Updating changelogs for the Gutenberg 5.9 packages release chore(release): publish [RNMobile] Fix pasting text on Post Title (#16116) Bump plugin version to 5.9.0 ... # Conflicts: # packages/block-library/src/video/video-player.android.js
Applying |
Description
Related: #16027, #15751
This PR explores using
className
for the text alignment in Heading block. It also moves this alignment to the block toolbar. There is a deprecation strategy necessary to make it work. It has been discussed with @kjellr and @jasmussen in #15964 (comment). This should allow us to make it easier to customize more complex blocks like List or Quote where we modify multiple styles depending on the text alignment selected. This will also allow us to simplify styles used, e.g.:gutenberg/packages/block-library/src/quote/theme.scss
Lines 16 to 28 in 04ca6b4
There are some important things to highlight:
align
is used with other blocks for the block alignment, renaming this attribute totextAlign
should better express its intentBefore:
After:
I also moved the control with text alignments to the block toolbar. This requires some tweaks for the level option which needs more love. I can remove it from this PR if it distracts the review process. I'm mostly concern about answering the question of whether we want to refactor the text alignment to work with class names.- removed from this PR. There are no visual changes.How has this been tested?
Using one of the existing branches (
master
probably) add a few Heading blocks and set different text alignments and save your post. Open the same post with this branch and ensure that it still worksChecklist: