FIxed bug [Bug] <Error MIME al cargar fuente “Arial” desde Google Fonts en exportaciones públicas>

Fixes #2435
This commit is contained in:
sahil
2025-11-05 16:12:57 +05:30
parent 03f15f91b3
commit b49798950a
2 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import { useEffect, useMemo } from "react";
import { Helmet } from "react-helmet-async";
import { Outlet } from "react-router";
import webfontloader from "webfontloader";
import { isLocalFont } from "@reactive-resume/utils";
import { useArtboardStore } from "../store/artboard";
@ -18,6 +19,15 @@ export const ArtboardPage = () => {
}, [metadata.typography.font]);
useEffect(() => {
const family = metadata.typography.font.family;
if (isLocalFont(family)) {
const width = window.document.body.offsetWidth;
const height = window.document.body.offsetHeight;
const message = { type: "PAGE_LOADED", payload: { width, height } };
window.postMessage(message, "*");
return;
}
webfontloader.load({
google: { families: [fontString] },
active: () => {

View File

@ -6,6 +6,10 @@ export type Font = {
files: Record<string, string>;
};
export const localFonts = ["Arial", "Cambria", "Garamond", "Times New Roman"];
export const isLocalFont = (family: string): boolean =>
localFonts.some((f) => f.toLowerCase() === family.toLowerCase());
export const fonts: Font[] = [
{
family: "Roboto",