zotero://select improvements

- Support items within collections and searches:

zotero://select/library/collections/:collectionKey/items/:itemKey
zotero://select/groups/:groupID/collections/:collectionKey/items/:itemKey

- Fix the 'itemKey' parameter:

zotero://select/library/collections/:collectionKey/items?itemKey=:itemKey1,:itemKey2

- Select library root if collection/search not specified
This commit is contained in:
Dan Stillman 2019-05-09 01:59:43 -04:00
parent 32de0d4037
commit ebda79a958
2 changed files with 38 additions and 6 deletions

View file

@ -874,6 +874,35 @@ function ZoteroProtocolHandler() {
return zp.collectionsView.selectCollection(results[0].id);
}
else {
// Select collection first if specified
if (params.scopeObject == 'collections') {
let col;
if (params.scopeObjectKey) {
col = Zotero.Collections.getByLibraryAndKey(
params.libraryID, params.scopeObjectKey
);
}
else {
col = Zotero.Collections.get(params.scopeObjectID);
}
yield zp.collectionsView.selectCollection(col.id);
}
else if (params.scopeObject == 'searches') {
let s;
if (params.scopeObjectKey) {
s = Zotero.Searches.getByLibraryAndKey(
params.libraryID, params.scopeObjectKey
);
}
else {
s = Zotero.Searches.get(params.scopeObjectID);
}
yield zp.collectionsView.selectSearch(s.id);
}
// If collection not specified, select library root
else {
yield zp.collectionsView.selectLibrary(params.libraryID);
}
return zp.selectItems(results.map(x => x.id));
}
}),