diff --git a/chrome/content/zotero/elements/attachmentAnnotationsBox.js b/chrome/content/zotero/elements/attachmentAnnotationsBox.js index 186752108a..27af270883 100644 --- a/chrome/content/zotero/elements/attachmentAnnotationsBox.js +++ b/chrome/content/zotero/elements/attachmentAnnotationsBox.js @@ -96,8 +96,6 @@ if (!this.initialized || !this.item?.isFileAttachment()) return; if (this._isAlreadyRendered()) return; - await Zotero.PDFWorker.renderAttachmentAnnotations(this.item.id); - this._body.replaceChildren(); if (!this._section.open || this._annotationItems.length === 0) { @@ -105,7 +103,19 @@ } this.hidden = false; + let imageAnnotationRendered = false; for (let annotation of this._annotationItems) { + if (!imageAnnotationRendered + && annotation.annotationType === 'image' + && !await Zotero.Annotations.hasCacheImage(annotation)) { + try { + await Zotero.PDFWorker.renderAttachmentAnnotations(annotation.parentID); + imageAnnotationRendered = true; + } + catch (e) { + Zotero.logError(e); + } + } this.addRow(annotation); } }