Don't use link icon in tabs or open-tabs menu. Resolve #3837

This commit is contained in:
Tom Najdek 2024-03-15 13:49:43 +01:00
parent e5dd25fbd5
commit f144f3a725
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77
2 changed files with 8 additions and 9 deletions

View file

@ -105,7 +105,7 @@ var Zotero_Tabs = new function () {
else if (tab.data?.itemID) { else if (tab.data?.itemID) {
try { try {
let item = Zotero.Items.get(tab.data.itemID); let item = Zotero.Items.get(tab.data.itemID);
icon = <CSSItemTypeIcon itemType={item.getItemTypeIconName()} className="tab-icon" />; icon = <CSSItemTypeIcon itemType={item.getItemTypeIconName(true)} className="tab-icon" />;
} }
catch (e) { catch (e) {
// item might not yet be loaded, we will get the icon on the next update // item might not yet be loaded, we will get the icon on the next update
@ -885,7 +885,7 @@ var Zotero_Tabs = new function () {
else { else {
span.classList.add("icon-item-type"); span.classList.add("icon-item-type");
let item = Zotero.Items.get(tab.data.itemID); let item = Zotero.Items.get(tab.data.itemID);
let dataTypeLabel = item.getItemTypeIconName(); let dataTypeLabel = item.getItemTypeIconName(true);
span.setAttribute("data-item-type", dataTypeLabel); span.setAttribute("data-item-type", dataTypeLabel);
} }

View file

@ -4407,13 +4407,12 @@ Zotero.Item.prototype.getImageSrc = function() {
} }
Zotero.Item.prototype.getItemTypeIconName = function () { Zotero.Item.prototype.getItemTypeIconName = function (skipLinkMode = false) {
var itemType = Zotero.ItemTypes.getName(this.itemTypeID); var itemType = Zotero.ItemTypes.getName(this.itemTypeID);
if (itemType == 'attachment') { if (itemType == 'attachment') {
var linkMode = this.attachmentLinkMode; var linkMode = this.attachmentLinkMode;
if (this.isPDFAttachment()) { if (this.isPDFAttachment()) {
if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) { if (!skipLinkMode && linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
itemType += 'PDFLink'; itemType += 'PDFLink';
} }
else { else {
@ -4421,7 +4420,7 @@ Zotero.Item.prototype.getItemTypeIconName = function () {
} }
} }
else if (this.isEPUBAttachment()) { else if (this.isEPUBAttachment()) {
if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) { if (!skipLinkMode && linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
itemType += 'EPUBLink'; itemType += 'EPUBLink';
} }
else { else {
@ -4429,15 +4428,15 @@ Zotero.Item.prototype.getItemTypeIconName = function () {
} }
} }
else if (this.isImageAttachment()) { else if (this.isImageAttachment()) {
itemType += linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE ? 'ImageLink' : 'Image'; itemType += linkMode == (!skipLinkMode && Zotero.Attachments.LINK_MODE_LINKED_FILE) ? 'ImageLink' : 'Image';
} }
else if (this.isVideoAttachment()) { else if (this.isVideoAttachment()) {
itemType += linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE ? 'VideoLink' : 'Video'; itemType += linkMode == (!skipLinkMode && Zotero.Attachments.LINK_MODE_LINKED_FILE) ? 'VideoLink' : 'Video';
} }
else if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) { else if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) {
itemType += "File"; itemType += "File";
} }
else if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) { else if (!skipLinkMode && linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
itemType += "Link"; itemType += "Link";
} }
else if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL) { else if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL) {