blockauote
This commit is contained in:
parent
56d11343f8
commit
f255ad6733
8 changed files with 97 additions and 53 deletions
33
maquette-tests/js/decor-blockquote.js
Normal file
33
maquette-tests/js/decor-blockquote.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { Handler } from '/csspageweaver/lib/paged.esm.js';
|
||||
|
||||
|
||||
export default class itemsDecor extends Handler {
|
||||
constructor(chunker, polisher, caller) {
|
||||
super(chunker, polisher, caller);
|
||||
this.symbol = ".";
|
||||
}
|
||||
afterPageLayout(pageElement, page, breakToken) {
|
||||
let blockquotes = pageElement.querySelectorAll("blockquote");
|
||||
blockquotes.forEach((blockquote) => {
|
||||
const container = document.createElement("div");
|
||||
container.className = "before-blockquote_container";
|
||||
const inner = document.createElement("div");
|
||||
inner.className = "before-blockquote";
|
||||
inner.textContent = this.symbol.repeat(300);
|
||||
container.appendChild(inner);
|
||||
blockquote.insertBefore(container, blockquote.firstChild);
|
||||
container.style.height = `${blockquote.offsetHeight}px`;
|
||||
|
||||
const containerAfter = document.createElement("div");
|
||||
containerAfter.className = "after-blockquote_container";
|
||||
const innerAfter = document.createElement("div");
|
||||
innerAfter.className = "after-blockquote";
|
||||
innerAfter.textContent = this.symbol.repeat(300);
|
||||
containerAfter.appendChild(innerAfter);
|
||||
blockquote.insertBefore(containerAfter, container.nextSibling);
|
||||
containerAfter.style.height = `${blockquote.offsetHeight}px`;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -10,9 +10,9 @@ export default class itemsDecor extends Handler {
|
|||
|
||||
afterPageLayout(pageElement, page, breakToken) {
|
||||
const numPage = parseInt(pageElement.dataset.pageNumber);
|
||||
const half = this.totalPages / 2;
|
||||
const isFirstHalf = numPage <= half;
|
||||
console.log(numPage, isFirstHalf ? "première moitié" : "deuxième moitié");
|
||||
// const half = this.totalPages / 2;
|
||||
// const isFirstHalf = numPage <= half;
|
||||
// console.log(numPage, isFirstHalf ? "première moitié" : "deuxième moitié");
|
||||
|
||||
const area = pageElement.querySelector(".pagedjs_area");
|
||||
if (area) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue