Skip to content

Commit 2c9dfda

Browse files
vincent69001claude
andcommitted
fix(docx-io): keep every nested inline formatting tag on DOCX export
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 6f3815d commit 2c9dfda

5 files changed

Lines changed: 509 additions & 26 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@platejs/docx-io": patch
3+
---
4+
5+
Fix DOCX export losing marks on text that carries several marks (for example bold and italic) and leaking a mark onto the text that follows it

‎apps/www/src/__tests__/package-integration/docx-io.roundtrip.slow.tsx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,20 @@ describe('docx roundtrip', () => {
105105

106106
expect(roundtrippedNodes.length).toBeGreaterThan(0);
107107
});
108+
109+
it('keeps every mark of a leaf that carries several marks', async () => {
110+
const editor = createTestEditor();
111+
const nodes: TNode[] = [
112+
{
113+
children: [{ bold: true, italic: true, text: 'bold italic' }],
114+
type: 'p',
115+
},
116+
];
117+
const roundtrippedNodes = await importDocxBuffer(
118+
editor,
119+
await exportNodesToDocx(nodes)
120+
);
121+
122+
expect(roundtrippedNodes).toEqual(nodes);
123+
});
108124
});

0 commit comments

Comments
 (0)