Don't try to modify non-editable annotation item when saving image
This commit is contained in:
parent
769bfbc892
commit
d4339f20bd
1 changed files with 16 additions and 0 deletions
|
@ -649,6 +649,22 @@ class ReaderInstance {
|
|||
instanceID: this._instanceID
|
||||
}
|
||||
};
|
||||
|
||||
// Note: annotation.image is always saved separately from the rest
|
||||
// of annotation properties
|
||||
|
||||
let item = Zotero.Items.getByLibraryAndKey(attachment.libraryID, annotation.key);
|
||||
// Save image for read-only annotation.
|
||||
if (item
|
||||
&& !item.isEditable()
|
||||
&& annotation.image
|
||||
&& !await Zotero.Annotations.hasCacheImage(item)
|
||||
) {
|
||||
let blob = this._dataURLtoBlob(annotation.image);
|
||||
await Zotero.Annotations.saveCacheImage(item, blob);
|
||||
continue;
|
||||
}
|
||||
|
||||
let savedAnnotation = await Zotero.Annotations.saveFromJSON(attachment, annotation, saveOptions);
|
||||
if (annotation.image && !await Zotero.Annotations.hasCacheImage(savedAnnotation)) {
|
||||
let blob = this._dataURLtoBlob(annotation.image);
|
||||
|
|
Loading…
Reference in a new issue