-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[WIP] Stabilize experimental Typography block support features within the block type class #7069
base: trunk
Are you sure you want to change the base?
Conversation
@@ -562,6 +580,29 @@ public function set_props( $args ) { | |||
} | |||
} | |||
|
|||
// Stabilize experimental block supports. |
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.
This code intentionally does not unset the experimental version of the supports. This is so that the un-updated JS code in the editor can handle the experimental syntax, and (for now at least) feels slightly safer in terms of backwards compatibility.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Based on discussion over in WordPress/gutenberg#63401 (comment), I've updated this to move the stabilization to after the filter is run. This ensures that any opt-outs, etc, performed by plugins are appropriately stabilized before the props are set. I've also moved the logic into a private method so that |
76ceb8d
to
886f3f1
Compare
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 Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
The latest plan is to backport all the block support stabilization updates in a single PR. This will include stabilizing border block supports and shared experimental flags such as More details can be found in WordPress/gutenberg#66918 (comment). In the near future, I'll pick up this backport and update it accordingly, while @andrewserong is away. |
Trac ticket: https://core.trac.wordpress.org/ticket/61728
🚧 🚧 🚧 WIP: This is currently a work in progress and is not yet ready for review as the Gutenberg PR has not been merged yet. 🚧 🚧 🚧
This PR syncs the PHP changes from WordPress/gutenberg#63401, however uses a slightly different approach for applying the transformations so that we do not depend on filters. The overall goal is the following:
Stabilize the following typography block supports by no longer requiring the
__experimental
prefix insupports.typography
inblock.json
and when registering block types:__experimentalFontFamily
→fontFamily
__experimentalFontStyle
→fontStyle
__experimentalFontWeight
→fontWeight
__experimentalLetterSpacing
→letterSpacing
__experimentalTextDecoration
→textDecoration
__experimentalTextTransform
→textTransform
The proposal here is to transform the
__experimental
form of the typography supports marks for stabilization when props are set on a block type instance. This occurs during registration or when aWP_Block_Type
object is instantiated. There was some discussion in an earlier Gutenberg PR about potentially performing this transformation in the block registry instead — however I couldn't find a good precedent for it, and it seems slightly more encapsulated to me to keep the transformation close to where thesupports
key is stored.I'm very happy for feedback on this, though!
For full testing instructions, please see the original Gutenberg PR: WordPress/gutenberg#63401
The short version is that all the typography block supports for static blocks such as Group or dynamic blocks such as Post Title should work just the same with this PR applied as without. Then, in follow-up work we can look at updating core blocks to use the non
__experimental
syntax.This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.