Skip to content

Commit d2a74ab

Browse files
committed
fix(docx-export): set table width to 100% to prevent shrinking
1 parent 9f16a7c commit d2a74ab

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/extensions/ExportWord/ExportWord.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/ban-ts-comment */
22
import { Extension } from '@tiptap/core';
3-
import { Packer } from 'docx';
3+
import { Packer, WidthType } from 'docx';
44
import { DocxSerializer, defaultMarks, defaultNodes } from 'prosemirror-docx';
55

66
import { ActionButton } from '@/components';
@@ -30,6 +30,16 @@ const nodeSerializer = {
3030
state.renderInline(node);
3131
state.closeBlock(node);
3232
},
33+
table(state: any, node: any) {
34+
state.table(node, {
35+
tableOptions: {
36+
width: {
37+
size: 100,
38+
type: WidthType.PERCENTAGE,
39+
},
40+
},
41+
});
42+
},
3343
};
3444
const docxSerializer = new DocxSerializer(nodeSerializer, defaultMarks);
3545

0 commit comments

Comments
 (0)