Skip to content
Merged
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
11 changes: 11 additions & 0 deletions packages/layout-engine/contracts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,17 @@ export type SectionMetadata = {
titlePg?: boolean;
/** Vertical alignment of content within this section's pages */
vAlign?: SectionVerticalAlign;
/** Section page margins in CSS px */
margins?: {
top?: number;
right?: number;
bottom?: number;
left?: number;
header?: number;
footer?: number;
} | null;
/** Section page size in CSS px */
pageSize?: { w: number; h: number } | null;
};

export type PageBreakBlock = {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout-engine/layout-bridge/src/incrementalLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export type HeaderFooterLayoutResult = {
layout: HeaderFooterLayout;
blocks: FlowBlock[];
measures: Measure[];
/** Effective layout width when table grid widths exceed section content width (SD-1837). */
effectiveWidth?: number;
};

export type IncrementalLayoutResult = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,11 +1385,7 @@ export const renderTableCell = (deps: TableCellRenderDependencies): TableCellRen
* indentation but skips marker text rendering).
*/
const shouldRenderMarker =
markerLayout &&
markerMeasure &&
lineIdx === 0 &&
localStartLine === 0 &&
markerMeasure.markerWidth > 0;
markerLayout && markerMeasure && lineIdx === 0 && localStartLine === 0 && markerMeasure.markerWidth > 0;

if (shouldRenderMarker) {
// Prepend marker + suffix inside lineEl (mirrors renderer.ts approach)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,8 @@ describe('analysis', () => {
footerRefs: { default: 'footer1' },
numbering: { format: 'decimal' },
titlePg: false,
margins: null,
pageSize: null,
});
});

Expand Down
2 changes: 2 additions & 0 deletions packages/layout-engine/pm-adapter/src/sections/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export function publishSectionMetadata(sectionRanges: SectionRange[], options?:
numbering: section.numbering,
titlePg: section.titlePg,
vAlign: section.vAlign,
margins: section.margins,
pageSize: section.pageSize,
});
});
}
Expand Down
12 changes: 12 additions & 0 deletions packages/super-editor/src/assets/styles/elements/prosemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
/* width: 100%; */
}

/* Header/footer editors: constrain table to the editor's available width.
Raw DOCX grid <col> widths may exceed the section's content area.
table-layout:auto treats col widths as preferred (not hard) constraints,
so the browser can redistribute columns to fit within width:100%.
!important overrides inline styles set by TableView.updateTable()
which resets styles via table.style.cssText. */
.sd-editor-scoped .ProseMirror.sd-header-footer table {
table-layout: auto !important;
width: 100% !important;
max-width: 100% !important;
}

.sd-editor-scoped .ProseMirror tr {
position: relative;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ export class EditorOverlayManager {
position: 'absolute',
pointerEvents: 'auto', // Critical: enables click interaction
visibility: 'hidden', // Hidden by default, shown during editing
overflow: 'hidden',
overflow: 'visible', // Allow table overflow (page's overflow:hidden still clips at page edge)
boxSizing: 'border-box',
});

Expand Down
Loading
Loading