1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Fix removing annotations with no type and attaching marks to invalid cfi

This commit is contained in:
Fred Chasen 2017-10-04 18:45:15 -07:00
parent 4f4a13fadb
commit bbb05616ab
7 changed files with 14 additions and 11 deletions

View file

@ -61,7 +61,7 @@ class Annotations {
let views = this.rendition.views();
views.each( (view) => {
views.forEach( (view) => {
if (annotation.sectionIndex === view.index) {
annotation.attach(view);
}
@ -75,12 +75,13 @@ class Annotations {
if (hash in this._annotations) {
let annotation = this._annotations[hash];
if (annotation.type !== type) {
if (type && annotation.type !== type) {
return;
}
let views = this.rendition.views();
views.each( (view) => {
views.forEach( (view) => {
this._removeFromAnnotationBySectionIndex(annotation.sectionIndex, hash);
if (annotation.sectionIndex === view.index) {
annotation.detach(view);