-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Backport: Gutenberg 44731 #3481
Conversation
I haven't tested it yet, but did you |
Yes, but I still didn't see the CSS file... |
Hmm, I am getting
|
src/wp-includes/script-loader.php
Outdated
// only handles external files or theme files. | ||
$editor_settings['styles'][] = array( | ||
'css' => file_get_contents( $classic_theme_styles ), | ||
'__unstableType' => 'theme', |
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 this should be core
? It's arguably Core that's providing this styling 🤔
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.
cc/ @oandregal @jorgefilipecosta for Global Styles expertise 😊
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'll tentatively change it to core
since IMO it better represents where the styling is coming from.
Since this is targeting classic themes, it shouldn't have any actual implications, since this is for Global Styles -- which are unavailable for Classic Themes.
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, that's a good idea.
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.
👋 Looked at where __unstableType
is used. It's only at https://github.com/WordPress/gutenberg/blob/88a1f7ae18bea3a13f6d1e507e3c25090b76cb08/packages/edit-post/src/editor.js#L165
If I'm reading the original PR correctly, this is used to decide whether to render a particular stylesheet when the user deactivates "theme styles". If the stylesheet needs to be disabled by that check, we should use "theme", otherwise "core" is fine. See check in this screen:
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.
These styles are the "default" ones set for buttons by core, they aren't connected to a specific theme, so I think core
is correct.
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.
Ugh, unit tests are failing because they cannot locate that file:
I'll look into this tomorrow. Not sure if something is off with the way we're building things for unit tests, or if there's another reason 😕 |
We found another bug with the original solution, which I have a fix for here: WordPress/gutenberg#45063 I'll also backport that in this PR |
Some quick thoughts on this:
|
Would it be simpler to just use a static CSS file? |
Probably 🤔 Maybe due to my ignorance -- there might be established patterns to deal with built CSS in a scenario like this, I'm just unaware of it. Would we lose anything significant if we made it static? |
Nothing at all |
Done in 20fed67, lets hope the tests pass! |
Using TwentyTwenty Twelve, it seems that the font color of the buttons is different 😢 |
I added a commit to fix Twenty Twelve |
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.
Thank you @scruffian! LGTM
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.
[committer double signoff]
The changeset looks good to me as well.
Self assigning for commit.
Edit: Not yet. See the comment below.
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.
Hmm, I think the PR is missing RTL styles, at least for Twenty Twenty.
Yes, Twenty Twenty also needs the RTL stylesheet, but block styles would belong in editor-style-block.css instead of classic. Twenty Twelve does not have an RTL stylesheet for the editor. |
The styles are already in |
The new inline styles come after
Twenty Twenty does not change text color on hover, but you could add the underline in
|
8ed4c10
to
98d03a5
Compare
@sabernhardt thanks that's super helpful. I have updated editor-style-blocks and revert the changes to the classic styles. I also updated the RTL stylesheet. Thanks again for all your help. |
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.
[committer double signoff] Yeah thanks for the changes. Looks good to me now 👍 |
Commit message draft:
|
Committed to Core |
Merged to the |
This backports WordPress/gutenberg#44731
I couldn't get it to work locally because the CSS file didn't seem to be there, but maybe I'm testing it wrong?