decor-6-expe/maquette-tests/js/decor-blockquote.js
2026-03-16 14:52:34 +01:00

33 lines
1.3 KiB
JavaScript

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`;
});
}
}