Commit eefb4224 authored by Fred Chasen's avatar Fred Chasen
Browse files

Merge branch 'master' into 'master'

Fixes 2 bugs in chunker layout.

Closes #183 and #172

See merge request tools/pagedjs!98
parents 63a36619 67287b36
Pipeline #432 passed with stage
in 3 minutes and 15 seconds
......@@ -285,11 +285,14 @@ class Layout {
if (!renderedNode) {
// Find closest element with data-ref
renderedNode = findElement(prevValidNode(temp), rendered);
return;
}
node = findElement(renderedNode, source);
offset = 0;
// renderedNode is actually the last unbroken box of rendered node
// We just need to return node as the next sibling of renderedNode within source node.
node = findElement(renderedNode, source).nextSibling;
offset = 0;
} else {
node = findElement(renderedNode, source);
offset = 0;
}
} else {
renderedNode = findElement(container, rendered);
......@@ -345,7 +348,8 @@ class Layout {
if (overflow) {
breakToken = this.createBreakToken(overflow, rendered, source);
if (breakToken["node"] && breakToken["offset"] && breakToken["node"].textContent) {
// breakToken is nullable
if (breakToken && breakToken["node"] && breakToken["offset"] && breakToken["node"].textContent) {
breakLetter = breakToken["node"].textContent.charAt(breakToken["offset"]);
} else {
breakLetter = undefined;
......
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