Commit a23d69cb authored by Fred Chasen's avatar Fred Chasen

only force last split element to justify

parent 63686db9
......@@ -14,6 +14,7 @@
size: A4;
margin: 8mm;
marks: crop cross;
bleed: 10mm;
}
@media screen {
......@@ -21,7 +22,7 @@
box-shadow: 0 0 0 1px rgba(0, 0,0,0.2);
}
.pagedjs_page {
.pagedjs_pagebox {
box-shadow: 0 0 0 1px rgba(200, 0,0,0.2);
}
}
......
......@@ -17,9 +17,10 @@ class Splits extends Handler {
prevPage = pages.children[index - 1];
let from; // Capture the last from element
splits.forEach((split) => {
let ref = split.dataset.ref;
let from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
if (from) {
from.dataset.splitTo = ref;
......@@ -28,17 +29,22 @@ class Splits extends Handler {
from.dataset.splitOriginal = true;
}
this.handleAlignment(from);
}
});
// Fix alignment on the deepest split element
if (from) {
this.handleAlignment(from);
}
}
handleAlignment(node) {
let styles = window.getComputedStyle(node);
let align = styles["text-align"];
let alignLast = styles["text-align-last"];
if (align === "justify" && alignLast === "auto") {
node.style["text-align-last"] = "justify";
node.dataset.forceTextAlignLast = "justify";
}
}
......
......@@ -415,6 +415,11 @@ export default `
list-style: none;
}
.pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-force-text-align-last='justify']
{
text-align-last: justify;
}
/*
[data-page]:not([data-split-from]),
[data-break-before="page"]:not([data-split-from]),
......
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