Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow uploading fonts from multiple font families at once using the U…
…ploads tab.
  • Loading branch information
matiasbenedetto committed Feb 28, 2024
commit a25150597d90724703af6e7c4a3bebd6631ba848
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,12 @@ function UploadFonts() {
const handleInstall = async ( fontFaces ) => {
const fontFamilies = makeFamiliesFromFaces( fontFaces );

if ( fontFamilies.length > 1 ) {
setNotice( {
type: 'error',
message: __(
'Variants from only one font family can be uploaded at a time.'
),
} );
setIsUploading( false );
return;
}
const installPromises = fontFamilies.map( ( fontFamily ) =>
installFont( fontFamily )
);

try {
await installFont( fontFamilies[ 0 ] );
await Promise.all( installPromises );
setNotice( {
type: 'success',
message: __( 'Fonts were installed successfully.' ),
Expand Down