Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/common/annotation-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/common/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down