mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-02 11:07:04 +00:00
refactor(fonts): use DEFAULT_FONTS as settings fallback
Avoids leaking a pairing's id/label into the stored book fonts.
This commit is contained in:
1 parent
baf1154683
commit
ecc94e6c31
1 file changed
+2
-1
@@ -6,6 +6,7 @@ import {
|
|||||||
type BookFonts,
|
type BookFonts,
|
||||||
type FontRef,
|
type FontRef,
|
||||||
BUNDLED_FONTS,
|
BUNDLED_FONTS,
|
||||||
|
DEFAULT_FONTS,
|
||||||
FONT_PAIRINGS,
|
FONT_PAIRINGS,
|
||||||
decodeRef,
|
decodeRef,
|
||||||
encodeRef,
|
encodeRef,
|
||||||
@@ -80,7 +81,7 @@ export function Settings({ onClose, onSave }: { onClose: () => void; onSave: ()
|
|||||||
isbn: book?.metadata.isbn ?? "",
|
isbn: book?.metadata.isbn ?? "",
|
||||||
language: book?.metadata.language ?? "en",
|
language: book?.metadata.language ?? "en",
|
||||||
bleed: book?.settings.bleed ?? true,
|
bleed: book?.settings.bleed ?? true,
|
||||||
fonts: book?.settings.fonts ?? FONT_PAIRINGS[0],
|
fonts: book?.settings.fonts ?? DEFAULT_FONTS,
|
||||||
}));
|
}));
|
||||||
const [system, setSystem] = useState<string[]>(() => systemFontCache ?? []);
|
const [system, setSystem] = useState<string[]>(() => systemFontCache ?? []);
|
||||||
const [advanced, setAdvanced] = useState(() => pairingFor(draft.fonts) === null);
|
const [advanced, setAdvanced] = useState(() => pairingFor(draft.fonts) === null);
|
||||||
|
|||||||
Reference in new issue
Block a user