From a8b89381cdc62fb3725be74590a509f5e87598d3 Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Mon, 4 Mar 2024 14:11:55 -0300 Subject: [PATCH] replace repeated implementation by the use of a existing fuction --- .../global-styles/font-library-modal/context.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/context.js b/packages/edit-site/src/components/global-styles/font-library-modal/context.js index c53f03e9b916fe..2e7f6f733e88f6 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/context.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/context.js @@ -415,12 +415,13 @@ function FontLibraryProvider( { children } ) { [ font.source ]: newFonts, } ); - const activatedFont = newFonts.find( ( f ) => f.slug === font.slug ); - const isFaceActivated = activatedFont?.fontFace?.find( - ( f ) => - f.fontWeight === face.fontWeight && - f.fontStyle === face.fontStyle + const isFaceActivated = isFontActivated( + font.slug, + face.fontStyle, + face.fontWeight, + font.source ); + if ( isFaceActivated ) { // Load font faces just in the iframe because they already are in the document. loadFontFaceInBrowser(