Skip to content
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

Toolkit plugin: Always enable line-height in Gutenberg settings #44772

Merged
merged 2 commits into from Aug 15, 2020

Conversation

noahtallen
Copy link
Member

@noahtallen noahtallen commented Aug 7, 2020

Note: this patch was applied directly to wpcom in our wpcom gutenberg loader files in D47818-code. This additionally makes the patch available for atomic sites. Once deployed, we can remove the existing wpcom patch.

Changes proposed in this Pull Request

Always enable the custom line-height setting. This overrides the default Gutenberg setting, which is to rely on theme support. We need this so that existing users on our wpcom simple and atomic infrastructure do not loose functionality when upgrading to the latest Gutenberg version.

Testing instructions

  1. on a test Atomic site with the latest version of the gutenberg plugin, you will not see line-height settings in the block sidebar.
  2. With this update also applied, you will see line-height settings.
TODO
  • Once we deploy this as a diff to wpcom, we need to revert the changes here: D47818-code (reverted in D49932-code)

@noahtallen noahtallen added [Type] Enhancement [Goal] Gutenberg Working towards full integration with Gutenberg labels Aug 7, 2020
@noahtallen noahtallen self-assigned this Aug 7, 2020
@matticbot
Copy link
Contributor

@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 7, 2020
@matticbot
Copy link
Contributor

Caution: This PR affects files in the Editing Toolkit Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D47821-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

@matticbot
Copy link
Contributor

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.

@noahtallen
Copy link
Member Author

note that @fullofcaffeine noticed that this throws a fatal error on atomic:

Uncaught TypeError: can't access property "__experimentalEnableLegacyWidgetBlock", e is null

@noahtallen
Copy link
Member Author

Just an FYI that I don't have the space to continue working on this. So if we still would like this solution to be in place, someone else will have to pick it up :)

@fullofcaffeine
Copy link
Member

note that @fullofcaffeine noticed that this throws a fatal error on atomic:

Uncaught TypeError: can't access property "__experimentalEnableLegacyWidgetBlock", e is null

I found out the root of the issue and fixed it. PHP couldn't find the function and was (silently) failing with the following warning:

[14-Aug-2020 23:15:08 UTC] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'wpcom_gutenberg_enable_custom_line_height' not found or invalid function name in __wp__/wp-includes/class-wp-hook.php on line 289

Passing the function path with the correct parent namespace prefix solves the issue 👍🏻

I tested this version with a fresh ephemeral AT site and the setting appears and works fine:

works

I do see some errors when the Editing Toolkit Plugin is activated though and seems related to the premium blocks... see the console in the screenshot above. Here's a more detailed screenshot with the stacktrace:

premiumcontenterror

While I think we can ignore these errors for the purposes of this PR, I'm pinging @kwight from Serenity, since I know they have been taking care of premium blocks lately. Kirk, do you have any insights about the error shown in the screenshot above? cc @noahtallen

Also, @noahtallen, since I've modified the PR, could you be the reviewer now 🥺?

Thanks!

@noahtallen
Copy link
Member Author

Ah, my bad about the namespace! :) I can also test this out in a bit and give a check, but I can't technically approve since I'm the author ;)

noahtallen and others added 2 commits August 14, 2020 17:56
PHP couldn't find the function and was (silently) failing with the following warning:

```
[14-Aug-2020 23:15:08 UTC] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'wpcom_gutenberg_enable_custom_line_height' not found or invalid function name in __wp__/wp-includes/class-wp-hook.php on line 289
```

Passing the function path with the correct parent namespace prefix solves the issue.
@noahtallen noahtallen force-pushed the add/line-height-fix-to-gutenberg branch from 9431d4a to 6a48c6e Compare August 15, 2020 00:58
@fullofcaffeine
Copy link
Member

@noahtallen I can merge if you sanity-check this :) I also added a TODO item in the description to remind us to revert the changes we made to gutenberg-wpcom.

Copy link
Member Author

@noahtallen noahtallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After removing the existing code on wpcom, I verified that the setting stopped showing up. Then, I synced this build to my sandbox and verified that the setting showed up again.

Screen Shot 2020-08-14 at 6 04 45 PM

I then transferred my test site to Atomic, installed a custom plugin. After making sure the line-height setting stopped showing up, I then uploaded the build of the toolkit plugin associated with this PR to my atomic site. I then verified the line-height setting started showing up on my Atomic site

Screen Shot 2020-08-14 at 6 10 19 PM

Copy link
Member

@fullofcaffeine fullofcaffeine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@fullofcaffeine fullofcaffeine merged commit 5240bef into master Aug 15, 2020
@fullofcaffeine fullofcaffeine deleted the add/line-height-fix-to-gutenberg branch August 15, 2020 01:15
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 15, 2020
@WunderBart
Copy link
Member

WP.com revert diff: D49932-code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg [Type] Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants