Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/xl-pdf-exporter/src/pdf/__snapshots__/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@
Styled Text
</TEXT>
<TEXT style={{}}>
{' '}
 
</TEXT>
<LINK href="https://www.blocknotejs.org">
<TEXT style={{}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@
Styled Text
</TEXT>
<TEXT style={{}}>
{' '}
 
</TEXT>
<LINK href="https://www.blocknotejs.org">
<TEXT style={{}}>
Expand Down
6 changes: 5 additions & 1 deletion packages/xl-pdf-exporter/src/pdf/pdfExporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ export class PDFExporter<
public transformStyledText(styledText: StyledText<S>) {
const stylesArray = this.mapStyles(styledText.styles);
const styles = Object.assign({}, ...stylesArray);
const textWithLeadingNbsp = styledText.text.replace(
/(^|\n) +/g,
(leadingWhiteSpaces) => leadingWhiteSpaces.replace(/ /g, "\u00A0"),
);
return (
<Text style={styles} key={styledText.text}>
{styledText.text}
{textWithLeadingNbsp}
</Text>
);
}
Expand Down
Loading