Repository navigation
fix(export): give an exported file the page margin on screen too - #1034
Merged
Merged
Conversation
The exported file used 40px on screen and the print margin on paper. Both now come from one --page-margin (1cm, 37.8px on screen), so the file keeps its shape when printed. The live preview's own padding is unchanged.
One reused jsdom document kept the computed style of the previous page, so the margin comparisons read the same value on both sides and could not fail. Each page now gets its own frame, var() is resolved against the root, and a zero margin fails outright.
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.
Follow-up to #1033, whose last two commits landed after the merge.
An exported file used 40px on screen and the 1cm print margin on paper. One
--page-marginin styles.css (1cm, which CSS draws as 37.8px on screen) is now the padding of the app's PDF, of a printed export and of an exported file on screen, so the file keeps its shape when printed. The live preview's own padding is unchanged.The margin tests #1033 added could not fail: one reused jsdom document kept the previous page's computed style, so both sides of each comparison read the same value, and jsdom computes a
var()padding as 0. Each page now renders in its own frame,var()is resolved against the root, and a zero margin fails outright.Verified: scripts/export.spec.ts fails with the print display rule removed, with 40px back on paper, with 40px on screen, and with --page-margin missing. Full node/vitest suites and svelte-check green. A built export in headless Chrome shows the same 1cm margin on screen and on paper.