Fix annotation image rendering caused issues:

- Don't save unmodified annotation item when rendering annotation image
- Don't render annotation image multiple times
This commit is contained in:
Martynas Bagdonas 2023-02-17 10:14:27 +00:00 committed by Dan Stillman
parent ba06db2e19
commit 429970ad30
2 changed files with 14 additions and 1 deletions

View file

@ -1109,6 +1109,19 @@ class ReaderInstance {
}
return;
}
// Save rendered image when annotation isn't modified
case 'saveImage': {
let { annotation } = message;
let { image, id: key } = annotation;
let attachment = Zotero.Items.get(this._itemID);
let libraryID = attachment.libraryID;
let item = Zotero.Items.getByLibraryAndKey(attachment.libraryID, key);
if (item) {
let blob = this._dataURLtoBlob(image);
await Zotero.Annotations.saveCacheImage({ libraryID, key }, blob);
}
return;
}
case 'setState': {
let { state } = message;
await this._setState(state);

@ -1 +1 @@
Subproject commit f720ff8348cfe2b0b548fe9683e02523ef2f378b
Subproject commit 590af780053f198838c0f3b4afa3f197ef45453e