-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Uploaded Fonts Are Not Reflected in Editor Canvas Immediately #58765
Comments
It seems that the loadFontFaceInBrowser function loads the font family with the incorrect font family name, especially for formatFontFamily. Here is the font we added to the document right after the installation: Note that the screenshot is from the value of However, it should be For example, if you make changes to styles manually after the installation, it works as expected. - --wp--preset--font-family--super-enjoy: "Super Enjoy";
+ --wp--preset--font-family--super-enjoy: \"Super Enjoy\"; |
I tested this one and can replicate it. It happens when the name of the uploaded font has a space (two or more words). Screen.Recording.2024-02-08.at.17.39.48.movThis is because the Unless I'm missing something, removing the use of Screen.Recording.2024-02-08.at.17.02.23.mov |
Is this related to how theme style variations that define font families don't have fonts loaded, unless you refresh? |
I don't think so, it seems like there is a problem with how the font names are rendered to CSS. |
Strange that I was unable to reproduce this with the suggested (or any) font. |
It appears that some fonts are problematic and others are not, regardless of whether they were uploaded by hand or not. The following Google Font also caused the problem, for example.
|
From what I checked, the problem with installing multi-word fonts from Google happens in Google Chrome, because it needs to receive the literal name when adding the font to the browser. It wasn't happening on Firefox, for example. I've updated the PR to cover both cases, and also to add the font to the browser (document and iframe) so that the font styles are reflected everywhere (also in the sidebar, when you install a Google font and see the font in the fonts list). |
I moved this to "In Progress" because @juanfra's PR seems to be addressing this issue. |
I reported this in trac to add the fixes into core repo https://core.trac.wordpress.org/ticket/60541#ticket |
Description
After uploading and activating new fonts through the Font Library modal in Gutenberg, changes are not immediately reflected in the editor's canvas. Specifically, when a new font is applied to a block, the canvas continues to display the default font until the browser tab is refreshed. It might be related to #58764.
Expected Behavior:
After a font is uploaded, activated, and applied to an element in Gutenberg, the canvas should immediately reflect this change without requiring a page refresh.
Actual Behavior:
The canvas does not update to show the newly applied font until after the browser tab where Gutenberg is open is refreshed.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Screen.Recording.2024-02-07.at.15.44.17.mov
Environment info
Gutenberg > 17.6
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: