Commit fc60a07e authored by Julie Blanc's avatar Julie Blanc
Browse files

[notes-float] set height of note areas + alert on overflow

parent e195fc24
......@@ -79,7 +79,7 @@ note.pagedjs_note {
font-weight: bold;
font-size: 12px;
line-height: 16px;
margin-top: 16px;
margin-top: 20px;
margin-right: 16px;
......@@ -157,7 +157,7 @@ body {
.temp-marker {
font-size: 20px;
/* font-size: 20px; */
color: green;
font-weight: bold;
......@@ -234,9 +234,3 @@ body {
border: none;
* ADDED FROM style-pagedjs-default
......@@ -198,7 +198,7 @@
and even he, with the aid of modern tools to cut up his wooden cubes, can only
show four widely spaced lines. Wetter<a class="afnanch" href="#fn10" id="fnanch10">10</a>
shows a page printed from perforated
and threaded wooden types<!--a class="afnanch" href="#fn11" id="fnanch11">11</a>-->; but these, though of large
and threaded wooden types<a class="afnanch" href="#fn11" id="fnanch11">11</a>; but these, though of large
size, only prove by their <span class="xxpn" id="p006">{6}</span>
“naughty caprioles” the absurdity of supposing that the “unleaded” <i>Speculum</i>,
a quarternion of which would require 40,000 distinct letters, could have been
......@@ -1157,52 +1157,11 @@
<li><a class="afnlabel" href="#fnanch11" id="fn11">11</a>
The history of these “fatal, unhistorical wooden types”
is worth recording for the warning of the over-credulous typographical
antiquary. Wetter, writing his book in 1836, and desirous to illustrate
the feasibility of the theory, “spent,” so Dr. Van der Linde writes,
“really the amount of ten shillings on having a number of letters made
of the wood of a pear-tree, only to please Trithemius, Bergellanus,
and Faust of Aschaffenburg. .&#160;.&#160;. His letters, although tied with
string, did not remain in the line, but made naughty caprioles. The
supposition—that by these few dancing lines the possibility is
demonstrated of printing with 40,000 wooden letters, necessary to
the printing of a quarternion, a whole folio book—is dreadfully
silly. The demonstrating facsimile demonstrates already the contrary.
Wetter’s letters not only declined to have themselves regularly
printed, but they also retained their pear-tree-wood-like impatience
afterwards.” The specimen of these types may be seen in the <i>Album</i>
of plates accompanying Wetter’s work, where they occupy the first
place, the matter chosen being the first few verses of the Bible,
occupying nineteen lines, and the type being about two-line English in
body. M. Wetter stated in his work that he had deposited the original
types in the Town Library of Mentz, where they might be inspected by
anyone wishing to do so. From this repository they appear ultimately
to have returned to the hands of M. Wetter’s printer. M. Bernard,
passing through Mentz in 1850, asked M. Wetter for a sight of them,
and was conducted to the printing office for that purpose, when it was
discovered that they had been stolen; whereupon M. Bernard remarks,
prophetically, “Peutêtre un jour quelque naïf Allemand, les trouvant
parmi les reliques du voleur, nous les donnera pour les caractères de
Gutenberg. Voilà comment s’établissent trop souvent les traditions.”
This prediction, with the one exception of the nationality of the
victim, was literally fulfilled when an English clergyman, some years
afterwards, discovered these identical types in the shop of
a curiosity-dealer at Mayence, and purchased them as
apparently veritable relics of the infancy of printing. After being
offered to the authorities at the British Museum and declined, they
were presented in 1869 to the Bodleian Library at Oxford, where they
remain to this day, treasured in a box, and accompanied by a learned
memorandum setting forth the circumstances of their discovery, and
citing the testimony of Roccha and other writers as to the existence
and use of perforated types by the early printers. The lines (which we
have inspected) remain threaded and locked in forme exactly as they
appear in Wetter’s specimen. It is due to the present authorities of
the Bodleian to say that they preserve these precious “relics,” without
prejudice, as curiosities merely, with no insistence on their historic
pretensions.</li> -->
antiquary. </li>
......@@ -1220,6 +1179,9 @@
books may be (and therefore also that they may have been) printed from
such separable wooden types.”—P. 424. -->
<li><a class="afnlabel" href="#fnanch13" id="fn13">13</a>
Van der Linde, <i>Haarlem Legend</i>. Lond., p. 72.</li>
......@@ -70,6 +70,9 @@ class NotesFloat extends Paged.Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
this.notesId = [];
this.notesHeight = 0;
this.marginBottomPrev = 0;
this.pagesNotesOverflow = [];
this.notesConfig = {
positionLeft: 'bottom left',
positionRight: 'bottom right',
......@@ -77,9 +80,7 @@ class NotesFloat extends Paged.Handler {
// afterPageLayout(pageElement, page, breakToken) {
// console.log('after page layout')
// }
beforeParsed(content) {
......@@ -170,6 +171,7 @@ class NotesFloat extends Paged.Handler {
const parent = pageArea.querySelectorAll('.pagedjs_page_content')[0];
let notesArea = document.createElement('div');
notesArea.className = 'pagedjs_notes-area';
let marginTopFirst;
// if page content has no notes area then create it
if (parent.querySelector('.pagedjs_notes-area') === null) {
parent.insertBefore(notesArea, parent.children[0]);
......@@ -177,6 +179,8 @@ class NotesFloat extends Paged.Handler {
let notesContentArea = document.createElement('div');
notesContentArea.className = 'pagedjs_notes-area_content';
// get margin-top of first note
marginTopFirst = window.getComputedStyle(node, null).getPropertyValue("margin-top");
} else {
notesArea = parent.querySelector('.pagedjs_notes-area');
......@@ -215,25 +219,63 @@ class NotesFloat extends Paged.Handler {
const isLeft = page.className.includes('pagedjs_left_page');
// find if this page has position bottom
const pageConf = isLeft ? this.notesConfig['positionLeft'] : this.notesConfig['positionRight'];
// if so displace the height of the element
// get margin of note
this.marginBottomPrev = window.getComputedStyle(node).marginBottom;
let marginTop = window.getComputedStyle(node).marginTop;
let marginNote;
if(this.marginBottomPrev > marginTop){
marginNote = this.marginBottomPrev;
}else {
marginNote = marginTop;
// get the height of page note area
this.notesHeight = this.notesHeight + parseInt(node.offsetHeight, 10) + parseInt(marginNote, 10);
let noteAreaHeight = this.notesHeight;
// get the height of page content area
let pageContentArea = parent.offsetHeight;
// if note area overflow
if(noteAreaHeight >= pageContentArea){
let numPage = node.closest('.pagedjs_page').getAttribute('data-page-number');
console.log(noteId + " overflow on page " + numPage);
if (pageConf.includes('bottom')) { = parent.offsetHeight - notesArea.clientHeight + 'px'; = pageContentArea - noteAreaHeight - 1 + 'px'; // subtract 1px to avoid overflow = "1px";
// remove the note if already exist
// remove the note if already exist in a previous note area
afterPageLayout(pages) {
// reset page area values
this.notesHeight = 0;
this.marginBottomPrev = 0;
let pagesText = this.pagesNotesOverflow[0];
for (let i = 1; i < this.pagesNotesOverflow.length; i++) {
pagesText = pagesText + ', ' + this.pagesNotesOverflow[i];
alert('Note(s) overflows on pages ' + pagesText);
......@@ -242,7 +284,7 @@ Paged.registerHandlers(NotesFloat);
/* import { isContainer, isElement } from "../../utils/dom"; */
/* PAGED.JS / import { isContainer, isElement } from "../../utils/dom"; */
function isContainer(node) {
let container;
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