Fix attachment annotation box render on non-PDF items (#4478)
This commit is contained in:
parent
7c3d04e03a
commit
9a9f11c5e3
1 changed files with 12 additions and 2 deletions
|
@ -96,8 +96,6 @@
|
||||||
if (!this.initialized || !this.item?.isFileAttachment()) return;
|
if (!this.initialized || !this.item?.isFileAttachment()) return;
|
||||||
if (this._isAlreadyRendered()) return;
|
if (this._isAlreadyRendered()) return;
|
||||||
|
|
||||||
await Zotero.PDFWorker.renderAttachmentAnnotations(this.item.id);
|
|
||||||
|
|
||||||
this._body.replaceChildren();
|
this._body.replaceChildren();
|
||||||
|
|
||||||
if (!this._section.open || this._annotationItems.length === 0) {
|
if (!this._section.open || this._annotationItems.length === 0) {
|
||||||
|
@ -105,7 +103,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hidden = false;
|
this.hidden = false;
|
||||||
|
let imageAnnotationRendered = false;
|
||||||
for (let annotation of this._annotationItems) {
|
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);
|
this.addRow(annotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue