-
Notifications
You must be signed in to change notification settings - Fork 2k
Support new line height setting #46792
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
Conversation
|
cc @jorgefilipecosta @nosolosw. What would be the ideal way to handle this use case? Specifically, we are using a filter to override gutenberg editor settings to always enable the line-height settings. This is because many of the themes on WordPress.com haven't opted-in to the setting yet, even though it works fine. (Plus, we had a lot of users using the feature before it was delegated to theme support!) Is this approach fine? Is there a better way to specify what the default setting should be for that variable? |
fullofcaffeine
left a comment
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.
Works great 👍🏻
|
Caution: This PR affects files in the Editing Toolkit Plugin on WordPress.com D51824-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing the Editing Toolkit Plugin for more info: PCYsg-ly5-p2 |
|
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
|
Building the ETP release is apparently blocked by #46811 currently 😕 |
Disregard, applying D51824-code to my sandbox works just fine. |
ockham
left a comment
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.
Working well 👍
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.
Testing via yarn dev --sync doesn't work for me because of the issue mentioned by @ockham, but after applying the corresponding diff D51824-code I was finally able to test it. All good, thanks! 🚢
| **/ | ||
| function wpcom_gutenberg_enable_custom_line_height( $settings ) { | ||
| $settings['enableCustomLineHeight'] = true; | ||
| if ( isset( $settings['__experimentalFeatures']['global']['typography'] ) ) { |
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.
Hi, I've already commented that this is a bug we need to fix, see WordPress/gutenberg#26537
I was thinking of a way to do it that's more robust than using __experimental.global.typography.customLineHeight (the shape of this can change as it's still experimental). What if you hook this function to after_setup_theme and make it declare theme support like add_theme_support('custom-line-height')?
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.
Made it more robust here: #46873. Thanks!
Changes proposed in this Pull Request
In WordPress/gutenberg#25738, Gutenberg moved the lineHeight setting to a new place in the settings object. It also introduced a (sort of?) bug where even though it has a mechanism to use the deprecated location for the setting, it is never used because the default value is returned instead.
This simply updates our existing filter to enable line height in the new location if the new location exists. I left the old setting in place as well, just in case we still need to support older gutenberg versions.
To test:
yarn dev --sync