Fix attachment annotation box render on non-PDF items (#4478)

This commit is contained in:
windingwind 2024-08-01 13:45:03 +08:00 committed by GitHub
parent 7c3d04e03a
commit 9a9f11c5e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}
}