Skip to content

Commit 36041a9

Browse files
committed
Improve page-break commenting
1 parent ade6f97 commit 36041a9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/plugin/pagebreaks.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import Worker from '../worker.js';
22

3+
// Add page-break functionality.
4+
5+
// Refs to original functions.
36
var orig = {
47
toContainer: Worker.prototype.toContainer
58
};
69

710
Worker.prototype.toContainer = function toContainer() {
811
return orig.toContainer.call(this).then(function toContainer_pagebreak() {
9-
// Enable page-breaks.
12+
// Find all page-break elements and setup page height.
1013
var pageBreaks = this.prop.container.querySelectorAll('.html2pdf__page-break');
1114
var pxPageHeight = this.prop.pageSize.inner.px.height;
15+
16+
// Set each page-break element to a block with the appropriate height.
1217
Array.prototype.forEach.call(pageBreaks, function pageBreak_loop(el) {
1318
el.style.display = 'block';
1419
var clientRect = el.getBoundingClientRect();

0 commit comments

Comments
 (0)