Skip to content

Commit

Permalink
RichTextBlock: only render div when disableLastBottomSpacing is s…
Browse files Browse the repository at this point in the history
…et (#292)

prevents invalid html when div is rendered inside p tag when a Typgraphy
is wrapped around the RichTextBlock

---------

Co-authored-by: Johannes Obermair <[email protected]>
  • Loading branch information
SebiVPS and johnnyomair authored Jul 11, 2024
1 parent 826c269 commit a1a9355
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions site/src/common/blocks/RichTextBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const RichTextBlock = withPreview(

return (
<PreviewSkeleton title="RichText" type="rows" hasContent={hasRichTextBlockContent(data)}>
<Root $disableLastBottomSpacing={disableLastBottomSpacing}>{rendered}</Root>
{disableLastBottomSpacing ? <DisableLastBottomSpacing>{rendered}</DisableLastBottomSpacing> : rendered}
</PreviewSkeleton>
);
},
Expand All @@ -145,9 +145,8 @@ export const PageContentRichTextBlock = (props: RichTextBlockProps) => (
</PageLayout>
);

const Root = styled.div<{ $disableLastBottomSpacing?: boolean }>`
${({ theme, $disableLastBottomSpacing }) =>
$disableLastBottomSpacing &&
const DisableLastBottomSpacing = styled.div`
${({ theme }) =>
css`
> *:last-child {
margin-bottom: 0;
Expand Down

0 comments on commit a1a9355

Please sign in to comment.