Fixed issue [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 18:59:20 +05:30
parent 2585c47de8
commit 4ccc7bae40
2 changed files with 11 additions and 7 deletions

View File

@ -1,8 +1,8 @@
import { isLocalFont } from "@reactive-resume/utils";
import { useEffect, useMemo } from "react"; import { useEffect, useMemo } from "react";
import { Helmet } from "react-helmet-async"; import { Helmet } from "react-helmet-async";
import { Outlet } from "react-router"; import { Outlet } from "react-router";
import webfontloader from "webfontloader"; import webfontloader from "webfontloader";
import { isLocalFont } from "@reactive-resume/utils";
import { useArtboardStore } from "../store/artboard"; import { useArtboardStore } from "../store/artboard";
@ -21,11 +21,14 @@ export const ArtboardPage = () => {
useEffect(() => { useEffect(() => {
const family = metadata.typography.font.family; const family = metadata.typography.font.family;
if (isLocalFont(family)) { if (isLocalFont(family)) {
let frame = 0;
frame = requestAnimationFrame(() => {
const width = window.document.body.offsetWidth; const width = window.document.body.offsetWidth;
const height = window.document.body.offsetHeight; const height = window.document.body.offsetHeight;
const message = { type: "PAGE_LOADED", payload: { width, height } }; const message = { type: "PAGE_LOADED", payload: { width, height } };
window.postMessage(message, "*"); window.postMessage(message, "*");
return; });
return () => { cancelAnimationFrame(frame); };
} }
webfontloader.load({ webfontloader.load({

View File

@ -1,4 +1,5 @@
import { describe, it, expect } from "vitest"; import { describe, expect,it } from "vitest";
import { isLocalFont, localFonts } from "../fonts"; import { isLocalFont, localFonts } from "../fonts";
describe("isLocalFont", () => { describe("isLocalFont", () => {