1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00
This commit is contained in:
Fred Chasen 2017-10-02 12:59:26 -07:00
commit c9990314b2

View file

@ -81,6 +81,7 @@ class Annotations {
let views = this.rendition.views(); let views = this.rendition.views();
views.each( (view) => { views.each( (view) => {
this._removeFromAnnotationBySectionIndex(annotation.sectionIndex, hash);
if (annotation.sectionIndex === view.index) { if (annotation.sectionIndex === view.index) {
annotation.detach(view); annotation.detach(view);
} }
@ -90,6 +91,14 @@ class Annotations {
} }
} }
_removeFromAnnotationBySectionIndex (sectionIndex, hash) {
this._annotationsBySectionIndex[sectionIndex] = this._annotationsAt(sectionIndex).filter(h => h !== hash);
}
_annotationsAt (index) {
return this._annotationsBySectionIndex[index];
}
highlight (cfiRange, data, cb) { highlight (cfiRange, data, cb) {
this.add("highlight", cfiRange, data, cb); this.add("highlight", cfiRange, data, cb);
} }