Skip to content

Commit

Permalink
Encode URI component in typography
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHerman committed Feb 20, 2024
1 parent b915473 commit 8c18685
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/font-family/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ function FontFamilyPicker( { label, value, help, instanceId, onChange, className
if ( ba.length > 0 ) {
//Load fonts on the header
if ( ! ba.includes( event.target.value ) && ! isSystemFont ) {
link.href = 'https://fonts.googleapis.com/css?family=' + event.target.value.replace( / /g, '+' ) + googleFontsAttr;
link.href = 'https://fonts.googleapis.com/css?family=' + window.encodeURIComponent( event.target.value.replace( / /g, '+' ) ) + googleFontsAttr;
document.head.appendChild( link );
}

ba = ba.replace( ',' + event.target.value, '' );
ba = ba + ',' + event.target.value;
} else {
link.href = 'https://fonts.googleapis.com/css?family=' + event.target.value.replace( / /g, '+' ) + googleFontsAttr;
link.href = 'https://fonts.googleapis.com/css?family=' + window.encodeURIComponent( event.target.value.replace( / /g, '+' ) ) + googleFontsAttr;
document.head.appendChild( link );

ba = event.target.value;
Expand Down

0 comments on commit 8c18685

Please sign in to comment.