diff --git a/src/common/annotation-manager.js b/src/common/annotation-manager.js index 26b52f229..d9371a33d 100644 --- a/src/common/annotation-manager.js +++ b/src/common/annotation-manager.js @@ -54,7 +54,7 @@ class AnnotationManager { this._annotations.push(annotation); } this._annotations.sort((a, b) => (a.sortIndex > b.sortIndex) - (a.sortIndex < b.sortIndex)); - this._clearInterferingHistory(annotations.map(x => x.id)); + this.clearInterferingHistory(annotations.map(x => x.id)); this.render(); } @@ -552,12 +552,6 @@ class AnnotationManager { if (annotation) { annotation.dateModified = (new Date()).toISOString(); } - // Assign new id when undeleting to reduce sync conflicts - if (!prevAnnotation) { - let newID = this._generateObjectKey(); - mapping.set(annotation.id, newID); - annotation.id = newID; - } allAnnotations.set(id, annotation); this._unsavedAnnotations.set(id, annotation); } @@ -585,12 +579,6 @@ class AnnotationManager { if (annotation) { annotation.dateModified = (new Date()).toISOString(); } - // Assign new id when undeleting to reduce sync conflicts - if (!prevAnnotation) { - let newID = this._generateObjectKey(); - mapping.set(annotation.id, newID); - annotation.id = newID; - } allAnnotations.set(id, annotation); this._unsavedAnnotations.set(id, annotation); } @@ -603,7 +591,7 @@ class AnnotationManager { return true; } - _clearInterferingHistory(affectedAnnotationIDs) { + clearInterferingHistory(affectedAnnotationIDs) { for (let i = this._undoStack.length - 1; i >= 0; i--) { if (affectedAnnotationIDs.some(id => this._undoStack[i].has(id))) { this._undoStack = this._undoStack.slice(i + 1); diff --git a/src/common/reader.js b/src/common/reader.js index 9857bd60f..1dbb50dbd 100644 --- a/src/common/reader.js +++ b/src/common/reader.js @@ -736,6 +736,10 @@ class Reader { this._annotationManager.unsetAnnotations(ids); } + clearAnnotationsEditHistory(ids) { + this._annotationManager.clearInterferingHistory(ids); + } + openContextMenu(params) { this._onBringReaderToFront?.(true); this._updateState({ contextMenu: params });