Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

bugfix: fix list break with marker (#3177) (#3178)

Andrea Accardo5080fddf514a
diff --git a/packages/pdf/src/templates/shared/rich-text.tsx b/packages/pdf/src/templates/shared/rich-text.tsx
index 29514e243..c305b2b5d 100644
--- a/packages/pdf/src/templates/shared/rich-text.tsx
+++ b/packages/pdf/src/templates/shared/rich-text.tsx
@@ -60,6 +60,11 @@ const applyRtlDirectionRecursively = (node: ReactNode): ReactNode => {
export const RichText = ({ children }: RichTextProps) => {
const { metadata, rtl } = useRender();
const rtlTextWrapStyle: Style | undefined = rtl ? { direction: "rtl", textAlign: "right" } : undefined;
+
+ const richListItemMarkerMargin: Style = {
+ marginLeft: rtl ? 4 : 0,
+ marginRight: rtl ? 0 : 4
+ };
const boldStyle = useTemplateStyle("bold");
const linkStyle = useTemplateStyle("link");
const richParagraphStyle = useTemplateStyle("richParagraph");
@@ -118,10 +123,11 @@ export const RichText = ({ children }: RichTextProps) => {
const contentItemStyles = itemStyles.map(stripRichTextVerticalMargins);
const markerNode = (
- <PdfText key="marker" style={composeStyles(richListItemMarkerStyle)}>
+ <PdfText key="marker" style={composeStyles(richListItemMarkerStyle, richListItemMarkerMargin)}>
{marker}
</PdfText>
);
+
// Same BiDi-injection trick as the <p> renderer — see applyRtlDirectionRecursively.
const contentNode = rtl ? (
<PdfText
@@ -147,7 +153,10 @@ export const RichText = ({ children }: RichTextProps) => {
safeTextStyle,
)}
>
- {children}
+ <View style={{ flexDirection: "row", alignItems: "flex-start" }}>
+ {markerNode}
+ {children}
+ </View>
</View>
);
@@ -162,7 +171,7 @@ export const RichText = ({ children }: RichTextProps) => {
getRichTextEdgeTrimStyle(element),
)}
>
- {rtl ? [contentNode, markerNode] : [markerNode, contentNode]}
+ {rtl ? [contentNode, markerNode] : contentNode}
</View>
);
},