Skip to content

Commit 4de7a90

Browse files
committed
fix: editor margins
1 parent 878523c commit 4de7a90

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/SuperDocPreview.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,19 @@ function wrapInDocument(xmlSnippet: string): string {
129129
return xmlSnippet;
130130
}
131131

132-
// Wrap the snippet in a document structure
132+
// Wrap the snippet in a document structure with small page size and margins
133+
// for better display in the preview container.
134+
// Page width: 4 inches = 5760 twips
135+
// Left/right margins: 0.1 inches = 144 twips
136+
// Top/bottom margins: 0.25 inches = 360 twips
133137
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
134138
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
135139
<w:body>
136140
${xmlSnippet}
141+
<w:sectPr>
142+
<w:pgSz w:w="5760" w:h="15840"/>
143+
<w:pgMar w:top="360" w:right="144" w:bottom="360" w:left="144" w:header="720" w:footer="720"/>
144+
</w:sectPr>
137145
</w:body>
138146
</w:document>`;
139147
}

0 commit comments

Comments
 (0)