-
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
Inline font-sizes to fix themes that don't enqueue the preset classes #22668
Conversation
Note that I've prepared this on top of #22356 which should be merged first. |
if ( | ||
! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || | ||
style?.typography?.fontSize || | ||
! fontSize |
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.
We shouldn't return early if the font size is not defined because it remounts the whole block when you select aa font size closing the inspector panels.
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.
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.
Maybe because the typography panel is open by default. if we change it to be closed by default you'll notice the issue. I had the issue with the color panel.
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.
I still think we need to remove style?.typography?.fontSize || ! fontSize
from here and only check the support here before merging.
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.
Yes, I'll check it now
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.
@youknowriad Do you know what style?.typography
is? That's not a CSS prop?
I've set |
Size Change: +106 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
99d6a8a
to
84f06b1
Compare
84f06b1
to
bb0ae85
Compare
3b91591
to
ba0e7ca
Compare
ba0e7ca
to
0cb918b
Compare
We should address this before merging too #22668 (comment) |
style?.typography?.fontSize | ||
).size; | ||
|
||
props.wrapperProps = { |
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.
I don't like mutating arguments personally. Ideally, we'd have a lint rule for that as it can potentially create weird issues. (Not certain it's the case here though)
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.
It's spread a few lines below, so it should be ok
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.
It should be spread before making the change. The problem here is that you're changing the value of an object defined elsewhere (the caller) which means potentially unexpected side effects there.
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 breaks throwing:
Uncaught TypeError: can't define property "wrapperProps": Object is not extensible
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.
Depends on #22356
I've set
fix/themes-not-loading-palette
as the base to easy review. This should be changed before merging the PR.This PR follows suit on what is proposed at #22356
It adds the font-size attribute as an inline style for the editor, regardless of the font value being a preset or a custom value. This is to fix themes that don't enqueue the preset classes. See context.
How to test