walter-boente_book-collection/js/numParagraph.js
2026-04-09 22:28:24 +02:00

27 lines
828 B
JavaScript

import { Handler } from '/csspageweaver/lib/paged.esm.js';
export default class thesis extends Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
}
afterPageLayout(pageElement, page, breakToken){
let nums = pageElement.querySelectorAll('ol[type="1"]');
nums.forEach(function (num) {
let totalHeight = 0;
let sibling = num.nextElementSibling;
while (sibling) {
if (sibling.matches('ol[type="1"], h1, h2, h3, h4, h5, h6, .container-following-note')) break;
totalHeight += sibling.offsetHeight;
sibling = sibling.nextElementSibling;
}
if (totalHeight > 0) {
num.style.height = totalHeight + 'px';
}
});
}
}