Skip to content

Commit

Permalink
feat: port emSize prop
Browse files Browse the repository at this point in the history
BREAKING CHANGE: dropped ptSize prop. Point is supposed to be an
absolute (pixel independant) size and unfit for display devices. It will
be translated by the CSS processor to an absolute unit.
  • Loading branch information
jsamr committed Jan 18, 2021
1 parent dab1d25 commit f567532
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 0 additions & 2 deletions packages/render-html/src/RenderHTML.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const propTypes: RenderHTMLPropTypes = {
height: PropTypes.number
}),
emSize: PropTypes.number.isRequired,
ptSize: PropTypes.number.isRequired,
baseStyle: PropTypes.object,
renderersProps: PropTypes.object,
onTTreeChange: PropTypes.func,
Expand All @@ -82,7 +81,6 @@ const defaultProps: {
decodeEntities: true
},
emSize: 14,
ptSize: 1.3,
ignoredTags: [],
ignoredStyles: [],
baseStyle: { fontSize: 14 },
Expand Down
4 changes: 3 additions & 1 deletion packages/render-html/src/hooks/useTRenderEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function useTRenderEngine(props: RenderResolvedHTMLProps) {
fallbackFonts,
systemFonts,
renderers = {},
emSize,
triggerTREInvalidationPropNames
} = props;
const isFontSupported = useMemo(() => {
Expand Down Expand Up @@ -99,7 +100,8 @@ export default function useTRenderEngine(props: RenderResolvedHTMLProps) {
cssProcessorConfig: {
isFontSupported,
inlinePropertiesBlacklist: ignoredStyles,
inlinePropertiesWhitelist: allowedStyles
inlinePropertiesWhitelist: allowedStyles,
rootFontSize: emSize
},
htmlParserOptions: {
decodeEntities: true,
Expand Down
4 changes: 0 additions & 4 deletions packages/render-html/src/shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ export interface RenderHTMLProps<P = any>
* The default value in pixels for 1em
*/
emSize?: number;
/**
* The default value in pixels for 1pt
*/
ptSize?: number;
/**
* Triggered when the transient render tree changes. Useful for debugging.
*/
Expand Down

0 comments on commit f567532

Please sign in to comment.