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,13 +326,25 @@ var Zotero_LocateMenu = new function() {
* Get the first 50 selected items
*/
function _getSelectedItems() {
var allSelectedItems = ZoteroPane_Local.getSelectedItems();
var selectedItems = [];
while(selectedItems.length < 50 && allSelectedItems.length) {
var item = allSelectedItems.shift();
if(!item.isNote()) selectedItems.push(item);
if (Zotero_Tabs.selectedID == 'zotero-pane') {
var allSelectedItems = ZoteroPane_Local.getSelectedItems();
var selectedItems = [];
while (selectedItems.length < 50 && allSelectedItems.length) {
var item = allSelectedItems.shift();
if (!item.isNote()) selectedItems.push(item);
}
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 [];
}
return selectedItems;
}
var ViewOptions = {};