-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix: Make fit text work with the interativity API. #72923
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
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
4940762 to
38bd3ee
Compare
3a3c98d to
ab40808
Compare
|
Size Change: -116 B (0%) Total Size: 2.45 MB
ℹ️ View Unchanged
|
8b2ce2e to
c0e98c1
Compare
|
After beta UX feedback, fit text is going to pass by a big change (moving from a block support to an independent block) so I merged all fit text related PR's before the big change. But I would be happy to receive feedback on this PR even with it merged, and will gladly apply any required changes. |
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: 7040958 |
Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: luisherranz <[email protected]>
Alternative to: #72797
Fit text did not work after navigating to a page using the Interactivity API router. When users navigated to a post via client-side navigation (e.g., in a Query block with pagination), fit text blocks would not recalculate their font sizes, appearing either too large or too small.
This occurred because the fit text initialization only ran on the
window.loadevent, which doesn't fire during client-side navigation.This PR refactors fit text front end to be an interactivity api first implementation, using an interactivity api init event instead of a window load event.
cc: @luisherranz
Changes
Updated
fit-text-frontend.js:initcallback.data-wp-initdirective to initialize fit text on element mount.Updated
typography.php:data-wp-interactive="core/fit-text"directive on blocks with fit text enabled.data-wp-init="callbacks.init"to trigger initialization.WP_HTML_Tag_Processorto safely modify block HTML.Updated
package.json:@wordpress/interactivitydependency to@wordpress/block-editorTesting Instructions