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

Improve handling of font license errors #359

Merged
merged 5 commits into from
May 10, 2023
Merged

Conversation

mikachan
Copy link
Member

@mikachan mikachan commented May 9, 2023

This PR improves the handling of errors caused by the font license functionality.

  • Checks if the font-credits form data is set and is an array before running any further code
  • Sets an empty object {} as the default state for the font-credits data
  • Checks that the font file has loaded successfully before setting the font-credits data
  • Ensures all Google fonts are served over https, to prevent mixed content errors

To test:

  1. Add a Google font to your theme (e.g. IBM Plex Mono)
  2. Add multiple font variants (e.g. 2 different font weights)
  3. The plugin should not crash or error
  4. Check that the font license has been added to the theme readme.txt correctly

@mikachan mikachan added the bug Something isn't working label May 9, 2023
@mikachan mikachan self-assigned this May 9, 2023
Copy link
Member

@madhusudhand madhusudhand left a comment

Choose a reason for hiding this comment

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

This is working as expected. 🚢

Few unrelated issues found while testing.

  • It leaves additional spaces for removed fonts.
image
  • Gives this error when a font is picked from the list.
image
  • And font-face.js (line 34) throws error because of tabindex instead of tabIndex. React context.

@mikachan
Copy link
Member Author

@mikachan mikachan merged commit f3949bd into trunk May 10, 2023
@mikachan mikachan deleted the fix/font-license-js-bug branch May 10, 2023 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working [Feature] Font Management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants