From 0ed34b4adad6a4f47ed5bfb6e5883e9d3474c87d Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 20 Feb 2024 13:48:53 +0100 Subject: [PATCH 1/2] Font Library: add option to revoke access to Google Fonts --- .../font-library-modal/font-collection.js | 31 ++++++++++++++++++- .../font-library-modal/tab-panel-layout.js | 9 +++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js index 6236ea8fe3f246..ddb2c65d2bb567 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js @@ -19,10 +19,11 @@ import { FlexItem, Flex, Button, + DropdownMenu, } from '@wordpress/components'; import { debounce } from '@wordpress/compose'; import { sprintf, __, _x } from '@wordpress/i18n'; -import { search, closeSmall } from '@wordpress/icons'; +import { search, closeSmall, moreVertical } from '@wordpress/icons'; /** * Internal dependencies @@ -76,6 +77,14 @@ function FontCollection( { slug } ) { return () => window.removeEventListener( 'storage', handleStorage ); }, [ slug, requiresPermission ] ); + const revokeAccess = () => { + window.localStorage.setItem( + 'wp-font-library-google-fonts-permission', + 'false' + ); + window.dispatchEvent( new Event( 'storage' ) ); + }; + useEffect( () => { const fetchFontCollection = async () => { try { @@ -223,11 +232,31 @@ function FontCollection( { slug } ) { ); } + let actionsComponent = null; + if ( ! renderConfirmDialog && ! selectedFont ) { + actionsComponent = ( + + ); + } + return ( - + { !! handleBack && (