Skip to content

Commit f5e4147

Browse files
Added a minimum width to the table columns (#1053)
1 parent a298999 commit f5e4147

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/Editor/CustomExtensions/Table/ExtensionConfig.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ const Table = TiptapTable.extend({
1616
},
1717
renderHTML({ node }) {
1818
const colgroups = node?.content?.content?.[0]?.content?.content?.map(
19-
col => ["col", { style: `width: ${col.attrs?.colwidth || 100}px;` }]
19+
col => {
20+
let style = "min-width: 100px;";
21+
if (col.attrs?.colwidth) style += `width: ${col.attrs.colwidth}px;`;
22+
23+
return ["col", { style }];
24+
}
2025
);
2126

2227
return ["table", {}, ["colgroup", ...colgroups], ["tbody", 0]];

0 commit comments

Comments
 (0)