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) {
try {
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) {
// 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 {
span.classList.add("icon-item-type");
let item = Zotero.Items.get(tab.data.itemID);
let dataTypeLabel = item.getItemTypeIconName();
let dataTypeLabel = item.getItemTypeIconName(true);
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);
if (itemType == 'attachment') {
var linkMode = this.attachmentLinkMode;
if (this.isPDFAttachment()) {
if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
if (!skipLinkMode && linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
itemType += 'PDFLink';
}
else {
@ -4421,7 +4420,7 @@ Zotero.Item.prototype.getItemTypeIconName = function () {
}
}
else if (this.isEPUBAttachment()) {
if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
if (!skipLinkMode && linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
itemType += 'EPUBLink';
}
else {
@ -4429,15 +4428,15 @@ Zotero.Item.prototype.getItemTypeIconName = function () {
}
}
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()) {
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) {
itemType += "File";
}
else if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
else if (!skipLinkMode && linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) {
itemType += "Link";
}
else if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL) {