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 Click to Tweet Font-Size controls and refactor to v2 #2268
Conversation
Download coblocks.zip: https://44370-128991767-gh.circle-artifacts.com/0/tmp/artifacts/coblocks-2268.zip |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Performance Test Results:
|
@@ -1,3 +1,4 @@ | |||
/* eslint-disable sort-keys */ |
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.
why do you disable the sort-keys and then sort them anyway?
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.
why do you disable the sort-keys and then sort them anyway?
This gave me a good laugh! Thank you for calling me out here. I think what I did was sort a few of them realize that the file also wanted me to sort all the old deprecations.
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.
Looks great to me! I have tested in TT2 and Go with WP 5.9 and in WP 5.8 and it always work. Good job!
Description
Click to Tweet block V2 API change.
This change opts the block into
fontSize
controls provided byblockSupports
in theblock.json
file.Deprecating from old fontSize controls are not working as expected. For whatever reason, the attributes will not migrate into the new object format and instead, we are forced to replace the block in the editor. Deprecated blocks come in with old attributes and are not correctly migrating attributes to new properties defined in the deprecated migration function.
Here are the attempted
isEligible
andmigrate
functions that were attempted and should work but do not properly transform the attributes to the new style.isEligible
migrate
Because blocks do not properly deprecate attributes into new attribute format we are forced to hack around the deprecation mechanism by replacing the block in the editor with the new style (or updating attributes to the new style manually).
This fix is similar to that of the Masonry block where attributes are not properly migrated and we are forced to replace the block with the correct attribute format.
Screenshots
Types of changes
JavaScript
How has this been tested?
Tested manually using old block markup.
Old Markup - v1
Old Markup - v1
Checklist: