Commit 977a070d authored by Julie Blanc's avatar Julie Blanc
Browse files

[notes-float] add notes container in note area

parent c08d0c9e
......@@ -174,11 +174,15 @@ class NotesFloat extends Paged.Handler {
if (parent.querySelector('.pagedjs_notes-area') === null) {
parent.insertBefore(notesArea, parent.children[0]);
notesArea.style.width = this.notesConfig.width;
let notesContentArea = document.createElement('div');
notesContentArea.className = 'pagedjs_notes-area_content';
notesArea.appendChild(notesContentArea);
} else {
notesArea = parent.querySelector('.pagedjs_notes-area');
}
if (!isElement(node)) {
return;
}
......@@ -192,7 +196,8 @@ class NotesFloat extends Paged.Handler {
}
// Add the note node
notesArea.appendChild(node);
let noteContainer = parent.querySelector('.pagedjs_notes-area_content');
noteContainer.appendChild(node);
// change the positionning of the note
node.style.position = 'relative';
node.style.display = 'block';
......@@ -210,60 +215,6 @@ class NotesFloat extends Paged.Handler {
// renderNode(node) {
// // if element is a note or contains a note we create a pagedjs_notes-area
// if (
// node.nodeType === 1 &&
// (node.querySelector(`.${NOTE_CLASS}`) || node.className.includes(NOTE_CLASS))
// // to do here: check if the paragraph with a note is going to be chuncked
// // if it's the case : check if the note is on first part of the paragraph or the second
// ) {
// const note = node.querySelector(`.${NOTE_CLASS}`) || node;
// // change the positionning of the note
// note.style.position = 'relative';
// note.style.display = 'block';
// // store the data-id of the note in a set
// let noteId = note.dataset.id;
// if(!this.notesId.includes(noteId)){
// this.notesId.push(noteId);
// }
// // to check if it has already added to a notes-area
// if(!document.querySelectorAll('.pagedjs_notes-area [data-id="' + noteId + '"]').length >= 1){
// // find page content
// const parent = node.closest('.pagedjs_page_content');
// let notesArea = document.createElement('div');
// notesArea.className = 'pagedjs_notes-area';
// // if page content has no notes area then create it
// if (parent.querySelector('.pagedjs_notes-area') === null) {
// parent.insertBefore(notesArea, parent.children[0]);
// notesArea.style.width = this.notesConfig.width;
// } else {
// notesArea = parent.querySelector('.pagedjs_notes-area');
// }
// // move the note to the container
// notesArea.appendChild(note);
// // find if we are on the left or right page
// const page = node.closest('.pagedjs_page');
// 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
// if (pageConf.includes('bottom')) {
// notesArea.style.marginTop = parent.offsetHeight - notesArea.clientHeight + 'px';
// }
// } else {
// // remove the note if already exist
// node.remove();
// }
// }
// }
afterPageLayout(pages) {
}
......
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