Skip to content
Merged
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
3 changes: 1 addition & 2 deletions packages/xl-pdf-exporter/src/pdf/__snapshots__/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,7 @@
>
<VIEW
style={{
backgroundColor: '#161616',
color: '#ffffff',
border: '1px solid #000000',
fontFamily: 'GeistMono',
fontSize: 12,
lineHeight: 1.25,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,7 @@
>
<VIEW
style={{
backgroundColor: '#161616',
color: '#ffffff',
border: '1px solid #000000',
fontFamily: 'GeistMono',
fontSize: 12,
lineHeight: 1.25,
Expand Down
10 changes: 7 additions & 3 deletions packages/xl-pdf-exporter/src/pdf/defaultSchema/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ export const pdfBlockMappingForDefaultSchema: BlockMapping<
);
},
codeBlock: (block) => {
const textContent = (block.content as StyledText<any>[])[0]?.text || "";
// Code blocks should always contain a single `StyledText` inline content.
// However, if this is not the case for whatever reason, we can merge the
// text content of all `StyledText` content in them.
const textContent = (block.content as StyledText<any>[])
.map((item) => item.text)
.join("");
const lines = textContent.split("\n").map((line, index) => {
const indent = line.match(/^\s*/)?.[0].length || 0;

Expand All @@ -135,8 +140,7 @@ export const pdfBlockMappingForDefaultSchema: BlockMapping<
wrap={false}
style={{
padding: 24 * PIXELS_PER_POINT,
backgroundColor: "#161616",
color: "#ffffff",
border: "1px solid #000000",
lineHeight: 1.25,
fontSize: FONT_SIZE * PIXELS_PER_POINT,
fontFamily: "GeistMono",
Expand Down
Loading