fix: space below a block need not fit on its page

LibreOffice drops it at the page bottom, as it drops space above at a page
top (probed: a paragraph 8mm clear of the bottom keeps its 2cm below and
stays). Counting it pushed the last block of a page down a page too early.
This commit is contained in:
Steffen Becker committed 2026-08-10 20:46:43 +00:00
1 parent 80e935145b
commit 970ad3776a
1 file changed
+4 -1
+4 -1
View File
@@ -1084,7 +1084,10 @@ export const PageBreaks = Extension.create({
bandOpenY: target,
reason: 'leaf-jump-to-next-page',
});
} else if (effectiveBottom + (leaf.spaceAfter ?? 0) > contentEnd) {
// Space below is not part of what has to fit: a block whose last line ends
// on the page keeps it and the gap is dropped at the page bottom, the way
// space above is at a page top (probed: 2cm below a line 8mm short of it).
} else if (effectiveBottom > contentEnd) {
if (leaf.kind === 'atomic') {
const cf = leaf.columnsFragment;
if (cf && cf.blockCount > 1 && cf.firstBlockNeededPx + COLUMNS_FIT_MARGIN_PX <= contentEnd - effectiveTop) {