feat(layout): enable odd/even header-footer support (w:evenAndOddHeaders)#2804
Open
gpardhivvarma wants to merge 1 commit intosuperdoc-dev:mainfrom
Open
feat(layout): enable odd/even header-footer support (w:evenAndOddHeaders)#2804gpardhivvarma wants to merge 1 commit intosuperdoc-dev:mainfrom
gpardhivvarma wants to merge 1 commit intosuperdoc-dev:mainfrom
Conversation
…ers) Thread alternateHeaders from document settings through the layout engine so the paginator selects the correct header/footer variant per page. Fixes margin calculation for documents with different odd and even page headers. Also fixes getVariantTypeForPage to use document page number (not section-relative) for even/odd selection, matching the rendering side (headerFooterUtils.ts). Closes superdoc-dev#2803
b0f0936 to
8c32cb3
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2803
alternateHeadersfrom document settings (w:evenAndOddHeaders) through the layout engine so the paginator selects the correct header/footer variant per pagegetVariantTypeForPageto use document page number (not section-relative) for even/odd selection, matching the rendering side (headerFooterUtils.ts)Problem
Documents with "Different Odd & Even Pages" enabled render the same header/footer on every page. The layout engine hardcoded
alternateHeaders = false, preventing correct margin calculations for odd vs even page headers.Changes
layout-engine/src/index.tsalternateHeaderstoLayoutOptions, replace hardcodedfalse, fixgetVariantTypeForPageto use document page number for even/oddlayout-engine/src/index.test.tsPresentationEditor.tsconverter.pageStyles.alternateHeadersinto layout optionstypes.tsalternateHeaderstoResolvedLayoutOptionsWhat was already working (no changes needed)
w:evenAndOddHeadersparsed fromsettings.xmlgetHeaderFooterTypeForSection()handles even/odd variant selectionsettings.xmlpreserved as-isTest plan
bun testin layout-engine — 581/581 passing