|
|
@@ -1135,6 +1135,7 @@ pre code {
|
|
|
element.style.setProperty(pointerEvents, "none", "important");
|
|
|
});
|
|
|
document.replaceChild(contentDocument.documentElement, document.documentElement);
|
|
|
+ document.querySelectorAll("[data-single-file-note-refs]").forEach(noteRefElement => noteRefElement.dataset.singleFileNoteRefs = noteRefElement.dataset.singleFileNoteRefs.replace(/,/g, " "));
|
|
|
deserializeShadowRoots(document);
|
|
|
document.querySelectorAll(NOTE_TAGNAME).forEach(containerElement => attachNoteListeners(containerElement, true));
|
|
|
document.documentElement.appendChild(getStyleElement(HIGHLIGHTS_WEB_STYLESHEET));
|
|
|
@@ -1170,6 +1171,7 @@ pre code {
|
|
|
const containerElement = document.createElement(NOTE_TAGNAME);
|
|
|
const noteElement = document.createElement("div");
|
|
|
const headerElement = document.createElement("header");
|
|
|
+ const blockquoteElement = document.createElement("blockquote");
|
|
|
const mainElement = document.createElement("textarea");
|
|
|
const resizeElement = document.createElement("div");
|
|
|
const removeNoteElement = document.createElement("img");
|
|
|
@@ -1177,13 +1179,15 @@ pre code {
|
|
|
const noteShadow = containerElement.attachShadow({ mode: "open" });
|
|
|
headerElement.appendChild(anchorIconElement);
|
|
|
headerElement.appendChild(removeNoteElement);
|
|
|
+ blockquoteElement.appendChild(mainElement);
|
|
|
noteElement.appendChild(headerElement);
|
|
|
- noteElement.appendChild(mainElement);
|
|
|
+ noteElement.appendChild(blockquoteElement);
|
|
|
noteElement.appendChild(resizeElement);
|
|
|
noteShadow.appendChild(getStyleElement(NOTES_WEB_STYLESHEET));
|
|
|
noteShadow.appendChild(noteElement);
|
|
|
const notesElements = Array.from(document.querySelectorAll(NOTE_TAGNAME));
|
|
|
const noteId = Math.max.call(Math, 0, ...notesElements.map(noteElement => Number(noteElement.dataset.noteId))) + 1;
|
|
|
+ noteElement.cite = "https://www.w3.org/TR/annotation-model/#selector(type=CssSelector,value=[data-single-file-note-refs~=\"" + noteId + "\"])";
|
|
|
noteElement.classList.add(NOTE_CLASS);
|
|
|
noteElement.classList.add(NOTE_ANCHORED_CLASS);
|
|
|
noteElement.classList.add(color);
|
|
|
@@ -2069,8 +2073,7 @@ pre code {
|
|
|
}
|
|
|
|
|
|
function getAnchorElement(containerElement) {
|
|
|
- return document.querySelector("[data-single-file-note-refs^=" + JSON.stringify(containerElement.dataset.noteId) + "], [data-single-file-note-refs$=" + JSON.stringify(containerElement.dataset.noteId) + "], [data-single-file-note-refs*=" + JSON.stringify("," + containerElement.dataset.noteId + ",") + "]")
|
|
|
- || document.documentElement;
|
|
|
+ return document.querySelector("[data-single-file-note-refs~=\"" + containerElement.dataset.noteId + "\"]") || document.documentElement;
|
|
|
}
|
|
|
|
|
|
function addNoteRef(anchorElement, noteId) {
|
|
|
@@ -2090,11 +2093,11 @@ pre code {
|
|
|
}
|
|
|
|
|
|
function getNoteRefs(anchorElement) {
|
|
|
- return JSON.parse("[" + (anchorElement.dataset.singleFileNoteRefs || "") + "]");
|
|
|
+ return anchorElement.dataset.singleFileNoteRefs ? anchorElement.dataset.singleFileNoteRefs.split(" ") : [];
|
|
|
}
|
|
|
|
|
|
function setNoteRefs(anchorElement, noteRefs) {
|
|
|
- anchorElement.dataset.singleFileNoteRefs = noteRefs.toString();
|
|
|
+ anchorElement.dataset.singleFileNoteRefs = noteRefs.join(" ");
|
|
|
}
|
|
|
|
|
|
function minifyText(text) {
|