Skip to content

Commit

Permalink
Floating images are always included in the current print page, even w…
Browse files Browse the repository at this point in the history
…hen they don't fit pagedjs#153

* Don't skip floating elements when looking for the overflow point.
  • Loading branch information
mflorea committed Sep 6, 2023
1 parent f22be9e commit a551c7b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/chunker/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,6 @@ class Layout {
let bottom = Math.floor(pos.bottom);

if (!range && (left >= end || top >= vEnd)) {
// Check if it is a float
let isFloat = false;

// Check if the node is inside a break-inside: avoid table cell
const insideTableCell = parentOf(node, "TD", rendered);
if (insideTableCell && window.getComputedStyle(insideTableCell)["break-inside"] === "avoid") {
Expand All @@ -568,7 +565,6 @@ class Layout {
prev = insideTableCell.parentElement;
} else if (isElement(node)) {
let styles = window.getComputedStyle(node);
isFloat = styles.getPropertyValue("float") !== "none";
skip = styles.getPropertyValue("break-inside") === "avoid";
breakAvoid = node.dataset.breakBefore === "avoid" || node.dataset.previousBreakAfter === "avoid";
prev = breakAvoid && nodeBefore(node, rendered);
Expand Down Expand Up @@ -623,7 +619,7 @@ class Layout {
break;
}

if (!br && !isFloat && isElement(node)) {
if (!br && isElement(node)) {
range = document.createRange();
range.selectNode(node);
break;
Expand Down

0 comments on commit a551c7b

Please sign in to comment.