Fix annotation saving regression
This commit is contained in:
parent
e9c6c76e79
commit
c5d418fc16
1 changed files with 11 additions and 15 deletions
|
@ -1028,24 +1028,20 @@ class ReaderInstance {
|
|||
saveOptions.notifierData.autoSyncDelay = Zotero.Notes.AUTO_SYNC_DELAY;
|
||||
}
|
||||
|
||||
// Note: annotation.image is always saved separately from the rest
|
||||
// of annotation properties
|
||||
if (annotation.image) {
|
||||
if (this._isReadOnly()) {
|
||||
let item = Zotero.Items.getByLibraryAndKey(attachment.libraryID, annotation.key);
|
||||
if (item) {
|
||||
let blob = this._dataURLtoBlob(annotation.image);
|
||||
await Zotero.Annotations.saveCacheImage(item, blob);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Delete authorName to prevent overwriting the existing annotationAuthorName value
|
||||
delete annotation.authorName;
|
||||
let savedAnnotation = await Zotero.Annotations.saveFromJSON(attachment, annotation, saveOptions);
|
||||
if (annotation.image && this._isReadOnly()) {
|
||||
let item = Zotero.Items.getByLibraryAndKey(attachment.libraryID, annotation.key);
|
||||
if (item) {
|
||||
let blob = this._dataURLtoBlob(annotation.image);
|
||||
await Zotero.Annotations.saveCacheImage(savedAnnotation, blob);
|
||||
await Zotero.Annotations.saveCacheImage(item, blob);
|
||||
}
|
||||
}
|
||||
// Delete authorName to prevent setting annotationAuthorName unnecessarily
|
||||
delete annotation.authorName;
|
||||
let savedAnnotation = await Zotero.Annotations.saveFromJSON(attachment, annotation, saveOptions);
|
||||
if (annotation.image) {
|
||||
let blob = this._dataURLtoBlob(annotation.image);
|
||||
await Zotero.Annotations.saveCacheImage(savedAnnotation, blob);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
Loading…
Reference in a new issue