Skip to content

Commit

Permalink
replace repeated implementation by the use of a existing fuction
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto committed Mar 4, 2024
1 parent 581d9ee commit a8b8938
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a8b8938

Please sign in to comment.