mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 04:22:27 +10:00
FIxed bug [Bug] <Error MIME al cargar fuente “Arial” desde Google Fonts en exportaciones públicas>
Fixes #2435
This commit is contained in:
@ -2,6 +2,7 @@ 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";
|
||||||
|
|
||||||
@ -18,6 +19,15 @@ export const ArtboardPage = () => {
|
|||||||
}, [metadata.typography.font]);
|
}, [metadata.typography.font]);
|
||||||
|
|
||||||
useEffect(() => {
|
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({
|
webfontloader.load({
|
||||||
google: { families: [fontString] },
|
google: { families: [fontString] },
|
||||||
active: () => {
|
active: () => {
|
||||||
|
|||||||
@ -6,6 +6,10 @@ export type Font = {
|
|||||||
files: Record<string, string>;
|
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[] = [
|
export const fonts: Font[] = [
|
||||||
{
|
{
|
||||||
family: "Roboto",
|
family: "Roboto",
|
||||||
|
|||||||
Reference in New Issue
Block a user