Merge pull request #53 from sgvictorino/prevent-duplicate-annotation-cards

fix: don't create duplicate annotation elements
This commit is contained in:
Achraf RRAMI 2024-04-06 21:11:37 +00:00 committed by GitHub
commit aac426d27e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,9 +41,11 @@ function getAnnotation(e) {
annotationDiv.innerHTML = parsedReponse.html annotationDiv.innerHTML = parsedReponse.html
annotationDiv.id = uri annotationDiv.id = uri
annotationDiv.className = "annotation" annotationDiv.className = "annotation"
if (!document.getElementById(uri)) {
e.target.parentElement.insertAdjacentElement('afterend', annotationDiv) e.target.parentElement.insertAdjacentElement('afterend', annotationDiv)
} }
} }
}
} }
window._currentTheme = localStorage.getItem("_theme") || "light" window._currentTheme = localStorage.getItem("_theme") || "light"