title same page notes

This commit is contained in:
Julie Blanc 2026-04-16 18:15:07 +02:00
parent 656e58b0f4
commit 5b1113c988
7 changed files with 64 additions and 5 deletions

View file

@ -9,7 +9,7 @@ export default class addPagesNotes extends Handler {
afterParsed(parsed){
let notes = parsed.querySelectorAll(".inline-note");
notes.forEach(function (note, index) {
console.log(note);
// console.log(note);
note.style.position = "absolute";
note.style.top = "0px";
note.style.left = "0px";
@ -33,6 +33,10 @@ export default class addPagesNotes extends Handler {
afterPageLayout(pageElement, page, breakToken, chunker) {
// add class if page contains h1
if (pageElement.querySelector('h1')) {
pageElement.classList.add('page-with-h1');
}
// move notes into previous page
let notes = pageElement.querySelectorAll(".body-note");
@ -51,9 +55,12 @@ export default class addPagesNotes extends Handler {
let pageNum = parseInt(pageElement.getAttribute('data-page-number'));
let prevPage = document.querySelector('[data-page-number="' + (pageNum - 1) + '"]');
if (prevPage) {
let content = prevPage.querySelector("#section_content");
let content = prevPage.querySelector('[data-id="section__content"]');
let contentId = prevPage.querySelector('#section__content');
if(content){
content.appendChild(container);
}else if(contentId){
contentId.appendChild(container);
}else{
prevPage.querySelector('.pagedjs_page_content').appendChild(container);
}
@ -67,7 +74,8 @@ export default class addPagesNotes extends Handler {
// create blank left page
if (
page.element.classList.contains('pagedjs_right_page') &&
page.element.querySelector('[data-id="section__content"]')
page.element.querySelector('[data-id="section__content"]') &&
!pageElement.querySelector('.before-h1')
) {
let notesPage = chunker.addPage();