This commit is contained in:
Julie Blanc 2026-02-24 09:11:23 +01:00
parent 31bb24548f
commit a8ab44f5a6
13 changed files with 257 additions and 52 deletions

View file

@ -11,7 +11,6 @@ export default class inlineNotes extends Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
this.section = cssPageWeaver.features.inlineNotes.parameters?.section || false,
this.input = cssPageWeaver.features.inlineNotes.parameters?.input || ".footnote-ref"; // ← CSS selector of the call element
this.containerNotes = cssPageWeaver.features.inlineNotes.parameters?.containerNotes || "#footnotes"; // ← CSS selector of the container of the footnote
this.newClass = cssPageWeaver.features.inlineNotes.parameters?.newClass || "inline-note"; // ← Class of the span create for the note
@ -22,7 +21,6 @@ export default class inlineNotes extends Handler {
inlineNotesHandler({
content: content,
input: this.input,
section: this.section,
containerNotes: this.containerNotes,
type: this.newClass
});
@ -37,25 +35,13 @@ function inlineNotesHandler(params){
let content = params.content;
let input = params.input;
let type = params.type;
let section = params.section;
let containerNotes = params.containerNotes;
createNotes(content, input, type);
if (section) {
let sections = content.querySelectorAll(section);
sections.forEach(sectionEl => {
createNotes(sectionEl, input, type);
let noteContainer = sectionEl.querySelector(containerNotes);
if (noteContainer) {
noteContainer.remove();
}
});
} else {
createNotes(content, input, type);
let noteContainer = content.querySelector(containerNotes);
if (noteContainer) {
let noteContainer = content.querySelector(params.containerNotes);
if(noteContainer){
noteContainer.remove();
}
}
}
}