-
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
Fix class serialization of font-size and colors in dynamic blocks that use block supports #35751
Conversation
Pushed a fix for font family at 21e6ab1 |
Pushed a fix for colors as well. Also pushed tests for both typography and colors. |
9b67881
to
53b1991
Compare
PHP Unit tests are failing 😕
|
Sorry for the naive question, but how do I register a font size? Copy-paste the snippet to the theme's |
It's Adding to Gutenberg's own diff --git a/lib/theme.json b/lib/theme.json
index f32734b6ef..0dd7f4a0e5 100644
--- a/lib/theme.json
+++ b/lib/theme.json
@@ -185,6 +185,11 @@
"customTextDecorations": true,
"customLetterSpacing": true,
"fontSizes": [
+ {
+ "slug": "h1",
+ "size": "32px",
+ "name": "Used in H1 titles"
+ },
{
"name": "Small",
"slug": "small", |
53b1991
to
f9c4700
Compare
Do you perhaps need to update the theme-experiments repo to the latest? We no longer support I'm looking now at the failing test. |
Pushed a change to fix the test. |
Ah, that seems to have done the trick 🤦♂️ I thought wp-env would take care of that for me, but turns out I had to manually |
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.
Thanks André, this is working great now 👍
Love the unit test coverage. I only had two minor notes -- feel free to address or ignore 😄
I see there's the React Native e2e test failure. I've seen this one in another of my PRs and the recommendation was to re-run the test until it passed. I want to use parts of this PR (test) on #31910 so I'm going to go ahead and merge this. |
Fixes #35708
Converting the slug to a kebab-case format has been problematic in the past. In the client, we use lodash's
kebabCase
, which has some peculiarities. In the server, we don't have that, so we createdgutenberg_experimental_to_kebab_case
function to replicate the most common use cases. See #32347 for details.Apparently, when that was implemented the block supports didn't get updated. Hence, blocks that are rendered in the server may still generate an incorrect class. This PR fixes the font size class generation.
How to test
The expected result at this point is that, in the editor, they have a new class called
.has-h-1-font-size
..has-h1-font-size
, which is incorrect as per lodash's kebabCase function).Related
Font family preset is being fixed at #31910