Skip to content
Open
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
37 changes: 37 additions & 0 deletions packages/layout-engine/pm-adapter/src/converters/table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,43 @@ describe('table converter', () => {
expect(result.attrs?.cellSpacing).toBe(5);
});

it('forwards tableIndent to table block attrs', () => {
const tableIndent = { width: 96, type: 'dxa' };
const node: PMNode = {
type: 'table',
attrs: {
tableIndent,
},
content: [
{
type: 'tableRow',
content: [
{
type: 'tableCell',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Indented cell' }] }],
},
],
},
],
};

const result = tableNodeToBlock(
node,
mockBlockIdGenerator,
mockPositionMap,
'Arial',
16,
mockStyleContext,
undefined,
undefined,
undefined,
undefined,
mockParagraphConverter,
) as TableBlock;

expect(result.attrs?.tableIndent).toEqual(tableIndent);
});

it('converts column widths from twips to pixels', () => {
const node: PMNode = {
type: 'table',
Expand Down
4 changes: 4 additions & 0 deletions packages/layout-engine/pm-adapter/src/converters/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,10 @@ export function tableNodeToBlock(
tableAttrs.tableWidth = hydratedTableStyle.tableWidth;
}

if (node.attrs?.tableIndent && typeof node.attrs.tableIndent === 'object') {
tableAttrs.tableIndent = { ...node.attrs.tableIndent };
}

// Pass tableLayout through (extracted by tblLayout-translator.js)
const tableLayout = node.attrs?.tableLayout;
if (tableLayout) {
Expand Down