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

Handle font licenses when editing theme metadata #649

Merged
merged 6 commits into from
May 30, 2024

Conversation

matiasbenedetto
Copy link
Contributor

@matiasbenedetto matiasbenedetto commented May 22, 2024

What

  • Handle font licenses in the frontend 'edit theme metadata'.
  • Adds a button to get theme fonts license text info updated.

Why?

To avoid the need of collecting the font licesing information manually.

How

Calls the /font-families/ endpoint and process the data to create the fille the font credits text area.
Using a button to get the latest licenses has 2 benefits:

  • Font assets metadata are loaded only when it is necessary.
  • The theme author can add extra text to the one auto generated.

⚠️ This PR depends on #648 being merged

Screencast

This video features how the font licences can be updated for a theme.

Screencast.from.30-05-24.12.00.58.webm

Copy link
Member

@vcanales vcanales left a comment

Choose a reason for hiding this comment

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

I see there are a few console.error calls; I think we should implement proper error management instead.

src/resolvers.js Outdated Show resolved Hide resolved
src/utils/fonts.js Outdated Show resolved Hide resolved
src/utils/fonts.js Outdated Show resolved Hide resolved
matiasbenedetto and others added 3 commits May 23, 2024 10:06
Co-authored-by: Vicente Canales <1157901+vcanales@users.noreply.github.com>
Co-authored-by: Vicente Canales <1157901+vcanales@users.noreply.github.com>
@matiasbenedetto
Copy link
Contributor Author

I removed the error handling where it was not needed and added it in the function where the license text is requested. If getting the license fails, the UI will throw an alert.

Until merging #648 this PR will display this error:

Screencast.from.23-05-24.12.20.13.webm

Why an alert? Because the snackbar is behind the modal component and is not visible. As that problem is not easy to fix (reference: WordPress/gutenberg#52609) I think for now the alert is good enough.

Screencast.from.23-05-24.12.02.53.webm

Copy link
Member

@vcanales vcanales left a comment

Choose a reason for hiding this comment

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

Looking good, although you'll probably have to update the branch with trunk, since there's a new eslint rule enforcing the specification of which rule is being disabled when eslint-disable comments are used.

@matiasbenedetto matiasbenedetto merged commit 10b9dcb into trunk May 30, 2024
2 checks passed
@matiasbenedetto matiasbenedetto deleted the add/handle-font-licenses-frontend branch May 30, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Font licenses are no longer automated with new Core Font Library functionality
2 participants