fix: a block at a page top loses its space above for good

The rule read the padding it had just zeroed, so it flipped every pass and
the ping-pong damper froze it on whichever state came first. Read the
block's own --space-before, which the decoration doesn't touch.
This commit is contained in:
Steffen Becker committed 2026-08-10 08:01:34 +00:00
1 parent b53838356b
commit ad446e9535
1 file changed
+3 -1
+3 -1
View File
@@ -1142,7 +1142,9 @@ export const PageBreaks = Extension.create({
i > 0 && !leaf.inTableCell
&& (breaks.some((b) => b.reason !== 'line-split')
|| (breaks.length === 0 && Math.abs(effectiveTop - contentStart) < 0.5))
&& parseFloat(getComputedStyle(leaf.el).paddingTop) > 0.5
// The block's own space above, not its rendered padding: the drop below
// zeroes that padding, so reading it back makes the rule flip every pass.
&& parseFloat(getComputedStyle(leaf.el).getPropertyValue('--space-before')) > 0.5
) {
const from = docPosBeforeElement(leaf.el);
const node = from !== null ? editorView.state.doc.nodeAt(from) : null;