You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support rendering of column line separators (#2088)
* feat: support column line separators
- Extracts 'w:sep' tag according to OOXML spec
- Renders one separator for each page column ('w:col' / 'w:num') in DOM painter
Closes#2067
* test: add docx file with line separator between columns enabled
* fix: rendering color of separators
* fix: reuse ColumnLayout and SINGLE_COLUMN_DEFAULT
* fix: ensure column width larger than separator width
* chore: lint
* chore: fix imports and missing SINGLE_COLUMN_DEFAULT usage
* chore: reuse type
* fix: render column separators per region on pages with continuous breaks
Two related fixes so the new column-line-separator feature works correctly
on pages where a continuous section break changes column layout mid-page.
1. isColumnConfigChanging now compares withSeparator. Before, a sep-only
toggle (count+gap unchanged) returned false, so no mid-page region was
created and the toggle was silently dropped. Applied in both
section-breaks.ts and the inline fallback in index.ts.
2. constraintBoundaries captured during layout are serialized onto a new
page.columnRegions contract field. renderColumnSeparators now iterates
regions and draws each separator bounded by its yStart/yEnd instead of
painting a single full-page overlay. When no mid-page change occurs,
columnRegions is omitted and the renderer falls back to page.columns
(unchanged behavior).
Verified by loading a fixture with 7 scenarios (2-col, 3-col, unequal
widths, separator on/off, continuous breaks toggling the separator).
Pages now show per-region separators tiled correctly; a 3-col region
followed by a 2-col region no longer paints a shared full-page line.
Out of scope here, tracked for follow-up: widths/equalWidth are still
dropped at pm-adapter extractColumns, so unequal-width separators render
at the equal-width midpoint; body-level w:sep is dropped at v2
docxImporter; there is no w:sep export.
* test: cover DomPainter renderColumnSeparators
13 unit tests over the separator renderer. Splits coverage into the
fallback path (page.columns only) and the region-aware path
(page.columnRegions).
Fallback path: pins the 2-col and 3-col geometry, and each early-return
guard (withSeparator false/undefined, single column, missing margins,
no columns at all, pathologically-small columnWidth).
Region path: verifies per-region yStart/yEnd bounding, mixed regions
(some draw, some skip for withSeparator=false or count<=1), zero-height
regions, and that columnRegions wins when both it and page.columns are
present.
Previously renderColumnSeparators had zero DOM-level coverage — the
region-aware refactor in the prior commit relied entirely on
layout-engine tests that never exercised the DOM output.
---------
Co-authored-by: Caio Pizzol <caio@harbourshare.com>
0 commit comments