Commit e7344f17 authored by Fred Chasen's avatar Fred Chasen

Hide footnotes content if empty

parent 0faacec4
Pipeline #693 passed with stage
in 3 minutes and 42 seconds
......@@ -75,7 +75,7 @@ const TEMPLATE = `
<div class="pagedjs_area">
<div class="pagedjs_page_content"></div>
<div class="pagedjs_footnote_area">
<div class="pagedjs_footnote_content">
<div class="pagedjs_footnote_content pagedjs_footnote_empty">
<div class="pagedjs_footnote_inner_content"></div>
</div>
</div>
......
......@@ -247,6 +247,11 @@ class Footnotes extends Handler {
// Add the note node
noteInnerContent.appendChild(node);
// Remove empty class
if (noteContent.classList.contains("pagedjs_footnote_empty")) {
noteContent.classList.remove("pagedjs_footnote_empty");
}
// Add marker
node.dataset.footnoteMarker = node.dataset.ref;
......@@ -418,6 +423,11 @@ class Footnotes extends Handler {
`${height + noteContentMargins + noteContentBorders + noteContentPadding}px`
);
// Hide footnote content if empty
if (noteInnerContent.childNodes.length === 0) {
noteContent.classList.add("pagedjs_footnote_empty");
}
if (!breakToken) {
chunker.clonePage(page);
} else {
......@@ -482,9 +492,13 @@ class Footnotes extends Handler {
let call = removed.querySelector(`[data-footnote-call="${note.dataset.ref}"]`);
if (call) {
note.remove();
// noteInnerContent.style.height = (noteAreaBounds.height + notePolicyDelta - total) + "px";
}
}
// Hide footnote content if empty
let noteInnerContent = area.querySelector(".pagedjs_footnote_inner_content");
if (noteInnerContent && noteInnerContent.childNodes.length === 0) {
noteInnerContent.parentElement.classList.add("pagedjs_footnote_empty");
}
}
totalMargins(element) {
......
......@@ -408,6 +408,10 @@ export default `
}
}
.pagedjs_footnote_empty {
display: none;
}
.pagedjs_area [data-split-from] {
counter-increment: unset;
counter-reset: 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