Commit 27f5a967 authored by Fred Chasen's avatar Fred Chasen

Add post layout split-to

parent 1b887733
Pipeline #40 failed with stage
import AtPage from './atpage';
import Breaks from './breaks';
import PrintMedia from './print-media'
import PrintMedia from './print-media';
import Splits from './splits';
export default [
AtPage,
Breaks,
PrintMedia
PrintMedia,
Splits
]
import Handler from "../handler";
class Splits extends Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
}
// layout(pageElement, page) {
//
// }
afterPageLayout(pageElement, page, breakToken, chunker) {
let splits = Array.from(pageElement.querySelectorAll("[data-split-from]"));
let pages = pageElement.parentNode;
let index = Array.prototype.indexOf.call(pages.children, pageElement);
let prevPage;
if (index === 0) {
return;
}
prevPage = pages.children[index - 1];
splits.forEach((split) => {
let ref = split.dataset.ref;
let from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
if (from) {
from.dataset.splitTo = ref;
}
});
}
}
export default Splits;
......@@ -240,6 +240,11 @@ export default `
display: block;
}
.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-to] {
margin-bottom: unset;
padding-bottom: unset;
}
.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-from] {
text-indent: unset;
margin-top: unset;
......
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