Commit 39b8e2bf authored by Guillaume's avatar Guillaume

Avoid breaking on the first and only row in the thead

parent 56ed03c9
Pipeline #617 passed with stage
in 7 minutes and 12 seconds
......@@ -24,7 +24,7 @@ import {
walk,
words
} from "../utils/dom";
import BreakToken from "./breaktoken";
import BreakToken from "./breaktoken";
import EventEmitter from "event-emitter";
import Hook from "../utils/hook";
......@@ -458,12 +458,16 @@ class Layout {
if (!range && left >= end) {
// 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") {
// breaking inside a table cell produces unexpected result, as a workaround, we forcibly avoid break inside in a cell.
prev = insideTableCell;
}
// Check if the node is the first and only row in the thead
else if (node.parentNode.nodeName === "THEAD" && node.parentNode.childElementCount === 1) {
// break on the table otherwise it will produce an empty table
prev = node.parentNode.parentNode;
} else if (isElement(node)) {
let styles = window.getComputedStyle(node);
isFloat = styles.getPropertyValue("float") !== "none";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment