-
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
Font Library: add option to revoke access to Google Fonts #59205
Conversation
Size Change: +123 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
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. |
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.
Thanks @carolinan for working on this.
This is looking good, and it's partially working as expected. I added some comments in the code.
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
Change the ActionsComponent to a function component. Add a constant for the name of the Google Fonts local storage item.
Flaky tests detected in 5c6366a. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8014167400
|
@matiasbenedetto Thank you for the review. I believe I have addressed everything. I hope the logic is correct. The tests are also finally passing, so this is ready for another review. |
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.
Thanks for this enhancement.
This is working as advertised.
LGTM
If we consider this a requirement for the MVP, I think it needs to have the backport to beta/ RC label. |
I found that this change is generating a visual regression: 2024-02-23.13-02-11.mp4 |
I don't know how to test with the other third party collection. :( |
You can try just by adding a collection. Add this PHP somewhere. I.e. to theme function register_my_collection() {
$ubuntu = array(
'font_family_settings' => array (
'name' => 'Ubuntu',
'fontFamily' => 'Ubuntu, sans-serif',
'slug' => 'ubuntu',
),
'categories' => array(
'sans-serif',
),
);
$verdana = array(
'font_family_settings' => array (
'name' => 'Verdana',
'fontFamily' => 'Verdana, sans-serif',
'slug' => 'verdana',
),
'categories' => array(
'sans-serif',
),
);
$times = array(
'font_family_settings' => array (
'name' => 'Times New Roman',
'fontFamily' => 'Times New Roman, serif',
'slug' => 'times-new-roman',
),
'categories' => array(
'serif',
),
);
$categories = array(
array (
'name' => 'Sans Serif',
'slug' => 'sans-serif',
),
array (
'name' => 'Serif',
'slug' => 'serif',
),
);
$font_families = array ( $ubuntu, $verdana, $times );
$collection = array(
'name' => 'My Custom Collection',
'description' => __( 'Custom fonts collection' ),
'font_families' => $font_families,
'categories' => $categories
);
wp_register_font_collection( 'my-collection', $collection );
}
add_action( 'rest_api_init', 'register_my_collection' ); |
* Font Library: add option to revoke access to Google Fonts --------- Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> # Conflicts: # packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
I just manually cherry-picked this PR to the cherry-pick-wp-6-5-beta-3 branch to get it included in the next release. |
* Font Library: add option to revoke access to Google Fonts --------- Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> # Conflicts: # packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
What?
Add an option to revoke access to Google Fonts to the the Font Library modal.
Partial for #54826
(Partial because it only supports Google Fonts not other third parties).
Why?
There was no option for revoking access to Google Fonts once access was granted.
How?
Adds a dropdown menu with an option that sets the 'wp-font-library-google-fonts-permission' local storage to false.
Testing Instructions
Activate a block theme.
Open the styles sidebar in the Site Editor.
Open the Typography panel, then open the Font Library
Select the "Install Fonts" tab.
If you have not already granted permission to access Google Fonts, there should be no visible change when the PR is applied.
After allowing access to Google Fonts, there should be a button with an ellipsis to the right of the "Google Fonts" title.
The ellipsis should not show when you view a single font. Only on the first page and on the paged results.
Clicking the option should open a popup with a single option "Revoke access to Google Fonts".
Selecting this option should display the "Connect to Google Fonts" banner and button again.
Testing Instructions for Keyboard
Screenshots or screencast