fix: revert font family, size and color when overrideFont is set, closes #792 (#804)

This commit is contained in:
Huang Xin
2025-04-03 23:15:19 +08:00
committed by GitHub
parent ee3785ad51
commit f8804b5d3c
2 changed files with 4 additions and 3 deletions
@@ -78,7 +78,7 @@ const FoliateViewer: React.FC<{
const docLoadHandler = (event: Event) => {
const detail = (event as CustomEvent).detail;
console.log('doc loaded:', detail);
console.log('doc index loaded:', detail.index);
if (detail.doc) {
const writingDir = viewRef.current?.renderer.setStyles && getDirection(detail.doc);
const viewSettings = getViewSettings(bookKey)!;
+3 -2
View File
@@ -73,8 +73,9 @@ const getFontStyles = (
font-size: ${fontSize * 3}px;
}
body * {
font-family: revert ${overrideFont ? '!important' : ''};
font-family: inherit;
${overrideFont ? 'font-family: revert !important' : ''};
${overrideFont ? 'font-size: revert !important' : ''};
${overrideFont ? 'color: revert !important' : ''};
}
`;
return fontStyles;