Locate menu: Get selected item(s) from current tab

This commit is contained in:
Abe Jellinek 2024-01-11 15:55:38 -05:00 committed by Dan Stillman
parent 424afb9af6
commit f44cc548f9

View file

@ -326,6 +326,7 @@ var Zotero_LocateMenu = new function() {
* Get the first 50 selected items
*/
function _getSelectedItems() {
if (Zotero_Tabs.selectedID == 'zotero-pane') {
var allSelectedItems = ZoteroPane_Local.getSelectedItems();
var selectedItems = [];
while (selectedItems.length < 50 && allSelectedItems.length) {
@ -334,6 +335,17 @@ var Zotero_LocateMenu = new function() {
}
return selectedItems;
}
else {
var reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
if (reader) {
let item = Zotero.Items.get(reader.itemID);
if (item.parentItem) {
return [item.parentItem];
}
}
return [];
}
}
var ViewOptions = {};