diff --git a/chrome/content/zotero/elements/attachmentBox.js b/chrome/content/zotero/elements/attachmentBox.js
index e991f69f0c..adfe4cbbe6 100644
--- a/chrome/content/zotero/elements/attachmentBox.js
+++ b/chrome/content/zotero/elements/attachmentBox.js
@@ -244,7 +244,7 @@
}
}
- render() {
+ async render() {
Zotero.debug('Refreshing attachment box');
if (this.usePreview) {
@@ -259,53 +259,46 @@
let indexStatusRow = this._id('indexStatusRow');
let selectButton = this._id('select-button');
+ let fileExists = await IOUtils.exists(this._item.getFilePath());
let isImportedURL = this.item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL;
let isLinkedURL = this.item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_LINKED_URL;
- // Metadata for URL's
- if (isImportedURL || isLinkedURL) {
- // URL
- if (this.displayURL) {
- let urlSpec = this.item.getField('url');
- urlField.setAttribute('value', urlSpec);
- urlField.setAttribute('tooltiptext', urlSpec);
- urlField.setAttribute('hidden', false);
- if (this.clickableLink) {
- urlField.onclick = function (event) {
- if (event.button == 0) {
- ZoteroPane_Local.loadURI(this.value, event);
- }
- };
- urlField.className = 'zotero-text-link';
- }
- else {
- urlField.className = '';
- }
- urlField.hidden = false;
+ // URL
+ if (this.displayURL && (isImportedURL || isLinkedURL)) {
+ let urlSpec = this.item.getField('url');
+ urlField.setAttribute('value', urlSpec);
+ urlField.setAttribute('tooltiptext', urlSpec);
+ urlField.setAttribute('hidden', false);
+ if (this.clickableLink) {
+ urlField.onclick = function (event) {
+ if (event.button == 0) {
+ ZoteroPane_Local.loadURI(this.value, event);
+ }
+ };
+ urlField.className = 'zotero-text-link';
}
else {
- urlField.hidden = true;
+ urlField.className = '';
}
-
- // Access date
- if (this.displayAccessed) {
- let itemAccessDate = this.item.getField('accessDate');
- if (itemAccessDate) {
- itemAccessDate = Zotero.Date.sqlToDate(itemAccessDate, true);
- this._id("accessed").value = itemAccessDate.toLocaleString();
- accessed.hidden = false;
- }
- else {
- accessed.hidden = true;
- }
+ urlField.hidden = false;
+ }
+ else {
+ urlField.hidden = true;
+ }
+
+ // Access date
+ if (this.displayAccessed && isImportedURL) {
+ let itemAccessDate = this.item.getField('accessDate');
+ if (itemAccessDate) {
+ itemAccessDate = Zotero.Date.sqlToDate(itemAccessDate, true);
+ this._id("accessed").value = itemAccessDate.toLocaleString();
+ accessed.hidden = false;
}
else {
accessed.hidden = true;
}
}
- // Metadata for files
else {
- urlField.hidden = true;
accessed.hidden = true;
}
@@ -345,7 +338,7 @@
pagesRow.hidden = true;
}
- if (this.displayDateModified && !this._item.isWebAttachment()) {
+ if (this.displayDateModified && fileExists && !this._item.isWebAttachment()) {
// Conflict resolution uses a modal window, so promises won't work, but
// the sync process passes in the file mod time as dateModified
if (this.synchronous) {
@@ -371,7 +364,7 @@
}
// Full-text index information
- if (this.displayIndexed) {
+ if (this.displayIndexed && fileExists && await Zotero.FullText.canIndex(this.item)) {
this.updateItemIndexedState()
.then(function () {
if (!this.item) return;
@@ -429,7 +422,7 @@
str = 'general.yes';
break;
}
- indexStatus.value = Zotero.getString(str);
+ indexStatus.textContent = Zotero.getString(str);
// Reindex button tooltip (string stored in zotero.properties)
str = Zotero.getString('pane.items.menu.reindexItem');
diff --git a/chrome/content/zotero/elements/attachmentPreview.js b/chrome/content/zotero/elements/attachmentPreview.js
index 8ea7314296..c8f2cc8d38 100644
--- a/chrome/content/zotero/elements/attachmentPreview.js
+++ b/chrome/content/zotero/elements/attachmentPreview.js
@@ -70,7 +70,7 @@
transparent="transparent"
src="resource://zotero/reader/reader.html"
flex="1"/>
-
+
{
diff --git a/scss/abstracts/_mixins.scss b/scss/abstracts/_mixins.scss
index 702aa8d709..62d8847d40 100644
--- a/scss/abstracts/_mixins.scss
+++ b/scss/abstracts/_mixins.scss
@@ -130,6 +130,10 @@
grid-template-columns: subgrid;
grid-column: span 2;
+ &[hidden] {
+ display: none;
+ }
+
// On hover of the meta-row, reveal all hidden icons
// unless there's .noHover class which keeps everything hidden
&:not(.noHover):hover .show-on-hover,
diff --git a/scss/elements/_attachmentBox.scss b/scss/elements/_attachmentBox.scss
index 2ad70fefdc..848b3f8756 100644
--- a/scss/elements/_attachmentBox.scss
+++ b/scss/elements/_attachmentBox.scss
@@ -25,8 +25,10 @@ attachment-box {
#index-status {
margin-inline: 0;
margin-block: 0;
- height: 22px;
- padding: 2px 4px;
+ margin-top: 2px;
+ @include comfortable {
+ margin-top: 3px;
+ }
}
#reindex
diff --git a/scss/elements/_attachmentPreview.scss b/scss/elements/_attachmentPreview.scss
index 28a5e0e4be..32f464c620 100644
--- a/scss/elements/_attachmentPreview.scss
+++ b/scss/elements/_attachmentPreview.scss
@@ -49,6 +49,7 @@ attachment-preview {
pdf: "attachment-pdf",
snapshot: "attachment-snapshot",
epub: "attachment-epub",
+ image: "document",
);
@each $cls, $icon in $preview-icons {
@@ -176,6 +177,10 @@ attachment-preview {
display: none;
}
+ .media-preview {
+ display: none !important;
+ }
+
.icon {
display: inline-block;
opacity: 1;