Skip to content

Commit

Permalink
fix: getCurrentItems in reader
Browse files Browse the repository at this point in the history
fix: #302
  • Loading branch information
windingwind committed Mar 30, 2024
1 parent 1a49cca commit f5d1c52
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/utils/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ async function getCurrentItems(type?: ActionShowInMenu) {
}
case "reader": {
const reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
if (reader) {
const annotationIDs =
// @ts-ignore TODO: update types
reader?._internalReader._lastView._selectedAnnotationIDs as string[];
if (annotationIDs?.length) {
for (const key of annotationIDs) {
const item = Zotero.Items.getByLibraryAndKey(
reader._item.libraryID,
key,
);
if (!item) continue;
items.push(item as Zotero.Item);
}
} else {
items = [reader._item];
}
break;
Expand Down

0 comments on commit f5d1c52

Please sign in to comment.