Fix attachment preview of the first added attachment (#3980)
Fixes #3973
This commit is contained in:
parent
86ee56cfac
commit
687ba53afd
1 changed files with 7 additions and 3 deletions
|
@ -98,9 +98,9 @@
|
||||||
notify(action, type, ids) {
|
notify(action, type, ids) {
|
||||||
if (!this._item?.isRegularItem()) return;
|
if (!this._item?.isRegularItem()) return;
|
||||||
|
|
||||||
|
this._updateAttachmentIDs().then(() => {
|
||||||
this.updatePreview();
|
this.updatePreview();
|
||||||
|
|
||||||
this._updateAttachmentIDs().then(() => {
|
|
||||||
let attachments = Zotero.Items.get((this._attachmentIDs).filter(id => ids.includes(id)));
|
let attachments = Zotero.Items.get((this._attachmentIDs).filter(id => ids.includes(id)));
|
||||||
if (attachments.length === 0) {
|
if (attachments.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -177,7 +177,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async updatePreview() {
|
async updatePreview() {
|
||||||
if (!this.usePreview || !this._section.open) {
|
if (!this.usePreview
|
||||||
|
// Skip only when the section is manually collapsed (when there's attachment),
|
||||||
|
// This is necessary to ensure the rendering of the first added attachment
|
||||||
|
// because the section is force-collapsed if no attachment.
|
||||||
|
|| (this._attachmentIDs.length && !this._section.open)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let attachment = await this._getPreviewAttachment();
|
let attachment = await this._getPreviewAttachment();
|
||||||
|
|
Loading…
Reference in a new issue