Skip to content

Commit

Permalink
fix: allow an empty object as param of buildTREFromConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jsamr committed Jun 10, 2021
1 parent fe9cd52 commit a71854f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/render-html/src/helpers/buildTREFromConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import TRenderEngine, {
export default function buildTREFromConfig(props: TRenderEngineConfig) {
const {
allowedStyles,
ignoredStyles,
// TODO fix upstream
ignoredStyles = [],
ignoredDomTags,
ignoreDomNode,
domVisitors,
Expand All @@ -26,8 +27,8 @@ export default function buildTREFromConfig(props: TRenderEngineConfig) {
idsStyles,
enableCSSInlineProcessing,
enableUserAgentStyles,
fallbackFonts,
systemFonts,
systemFonts = [],
fallbackFonts = {},
customHTMLElementModels = {},
emSize,
setMarkersForTNode,
Expand All @@ -41,12 +42,12 @@ export default function buildTREFromConfig(props: TRenderEngineConfig) {
}
: undefined;
const fontMap = {} as Record<string, true>;
systemFonts!.forEach((font) => {
systemFonts.forEach((font) => {
fontMap[font] = true;
});
const isFontSupported = (fontFamily: string) => {
if (fallbackFonts![fontFamily as keyof typeof fallbackFonts]) {
return fallbackFonts![fontFamily as keyof typeof fallbackFonts];
if (fallbackFonts[fontFamily as keyof typeof fallbackFonts]) {
return fallbackFonts[fontFamily as keyof typeof fallbackFonts];
}
return fontMap[fontFamily] || false;
};
Expand Down

0 comments on commit a71854f

Please sign in to comment.