Skip to content

Commit

Permalink
fix the live preview (without reloading the page) of the just install…
Browse files Browse the repository at this point in the history
…ed fonts in the editor
  • Loading branch information
matiasbenedetto committed Nov 24, 2023
1 parent a414e3f commit 0d8330c
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { paramCase as kebabCase } from 'change-case';
* Internal dependencies
*/
import { FONT_WEIGHTS, FONT_STYLES } from './constants';
import { formatFontFamily } from './preview-styles';

export function setUIValuesNeeded( font, extraValues = {} ) {
if ( ! font.name && ( font.fontFamily || font.slug ) ) {
Expand Down Expand Up @@ -90,14 +89,10 @@ export async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {
}

// eslint-disable-next-line no-undef
const newFont = new FontFace(
formatFontFamily( fontFace.fontFamily ),
dataSource,
{
style: fontFace.fontStyle,
weight: fontFace.fontWeight,
}
);
const newFont = new FontFace( fontFace.fontFamily, dataSource, {
style: fontFace.fontStyle,
weight: fontFace.fontWeight,
} );

const loadedFace = await newFont.load();

Expand Down

0 comments on commit 0d8330c

Please sign in to comment.