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

Fix CoBlocks fonts issue for simple sites #72679

Merged
merged 3 commits into from
Feb 1, 2023
Merged

Fix CoBlocks fonts issue for simple sites #72679

merged 3 commits into from
Feb 1, 2023

Conversation

dsas
Copy link
Contributor

@dsas dsas commented Jan 26, 2023

CoBlocks typography support is adding an extra style rule to blocks when using setting fonts. This causes a block validation error.

This change removes the filter that does that - we disable typography support anyway.

Proposed Changes

Don't allow the CoBlocks font settings filter to run on simple sites. We don't display the font controls but the filter that process them still runs. This filter was causing an 'unexpected or invalid content' block error when pasting blocks with custom fonts (or inserting patterns with the same)

Note that this does not fix the problem for atomic sites. Atomic sites use the latest upstream versions of CoBlocks which aren't possible to do surgical fixes on, since the filter is bundled into a megafilter. An issue has been opened upstream to fix the root problem.

Testing Instructions

  1. Have a site that pre-dates 2021-10-26 (or make wpcom_is_site_eligible_for_coblocks return true in your sandbox)
  2. Visit the post editor
  3. Paste this into the editor:
<!-- wp:heading {"className":"has-custom-font","fontFamily":"dm-sans"} -->
<h2 class="wp-block-heading has-custom-font has-dm-sans-font-family">Summer<br>Vibe</h2>
<!-- /wp:heading -->
  1. You should see an error about unexpected or invalid content
  2. Use the install script comment below
  3. Sandbox widgets.wp.com
  4. Repeat steps 2 & 3
  5. You should not see an error, you should see a heading block using the dm-sans font.

Ensure you test pasting the content into a brand new post, and when editing an existing post.

Before After
image image

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready fortranslation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

Related to #72261 & pekYwv-mT-p2#comment-301

CoBlocks typography support is adding an extra style rule to blocks when
using setting fonts. This causes a block validation error.

This change removes the filter that does that - we
disable typography support anyway.
@dsas dsas requested a review from a team January 26, 2023 21:49
@dsas dsas self-assigned this Jan 26, 2023
@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 Jan 26, 2023
@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.

@github-actions
Copy link

github-actions bot commented Jan 26, 2023

@matticbot
Copy link
Contributor

This PR modifies the release build for wpcom-block-editor

To test your changes on WordPress.com, run install-plugin.sh wpcom-block-editor fix/coblocks-fonts on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-l4k-p2

@mmtr
Copy link
Member

mmtr commented Jan 31, 2023

You should not see an error, you should see a heading block using the dm-sans font.

I still got the error, not sure if I'm missing any testing step but I made sure to follow all the instructions. I also checked that my sandbox was serving the wpcom-block-editor app with these changes.

Screen.Recording.2023-01-31.at.12.07.03.mov

@dsas
Copy link
Contributor Author

dsas commented Jan 31, 2023

It looks like I misunderstood isEditorReadyWithBlocks which meant that this PR didn't work on a new post, only on an edit. I'll find an alternative.

Copy link
Member

@mmtr mmtr left a comment

Choose a reason for hiding this comment

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

Works as expected now for both new and existing posts.

@dsas dsas merged commit 8b37c0a into trunk Feb 1, 2023
@dsas dsas deleted the fix/coblocks-fonts branch February 1, 2023 13:30
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 1, 2023
@dsas
Copy link
Contributor Author

dsas commented Feb 1, 2023

Deployed r260549-wpcom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants