From 2dfb243924b5f33eabe00302c298d0bdbb51b071 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Fri, 28 Jun 2024 13:42:45 -0700 Subject: [PATCH] Show correct context menu and itemPane header for collections in trash (#4297) - only have enabled "Permanently delete" and "Restore to library" options in the context menu for collections and searches in the trash - display the custom header with buttons to delete or restore in the itemPane when a collection or search in the trash is selected Fixes: #4295 --- chrome/content/zotero/elements/itemPane.js | 4 +++- chrome/content/zotero/zoteroPane.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/elements/itemPane.js b/chrome/content/zotero/elements/itemPane.js index 73938d0410..ef9ccea6fe 100644 --- a/chrome/content/zotero/elements/itemPane.js +++ b/chrome/content/zotero/elements/itemPane.js @@ -492,7 +492,9 @@ getCurrentPane(mode = undefined) { if (!mode) { // Guess a mode from the current data - if (!this.data.length || this.data.length > 1) { + // No/multiple objects are selected OR selected object is a trashed collection/search + if (!this.data.length || this.data.length > 1 + || this.data[0] instanceof Zotero.Collection || this.data[0] instanceof Zotero.Search) { mode = "message"; } else if (this.data[0].isNote()) { diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index e5d1bdfd56..8782fa0f78 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3558,7 +3558,7 @@ var ZoteroPane = new function() show.add(m.loadReport); } - var items = this.getSelectedItems(); + var items = this.getSelectedObjects(); if (items.length > 0) { // Multiple items selected