Select parent item after metadata retrieval if only PDF was selected
TODO: select all parents
This commit is contained in:
parent
16ad422e89
commit
6c8cf71c9a
|
@ -349,6 +349,16 @@ Zotero.RecognizePDF = new function () {
|
||||||
throw new Zotero.Exception.Alert('recognizePDF.error');
|
throw new Zotero.Exception.Alert('recognizePDF.error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var zp = Zotero.getActiveZoteroPane();
|
||||||
|
var selectParent = false;
|
||||||
|
if (zp) {
|
||||||
|
let selected = zp.getSelectedItems();
|
||||||
|
if (selected.length) {
|
||||||
|
// If only the PDF was selected, select the parent when we're done
|
||||||
|
selectParent = selected.length == 1 && selected[0] == attachment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let parentItem = await _recognize(attachment);
|
let parentItem = await _recognize(attachment);
|
||||||
if (!parentItem) {
|
if (!parentItem) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -387,6 +397,18 @@ Zotero.RecognizePDF = new function () {
|
||||||
await attachment.saveTx();
|
await attachment.saveTx();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
zp = Zotero.getActiveZoteroPane();
|
||||||
|
if (zp) {
|
||||||
|
if (selectParent) {
|
||||||
|
await zp.selectItem(parentItem.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
Zotero.logError(e);
|
||||||
|
}
|
||||||
|
|
||||||
_newItems.set(
|
_newItems.set(
|
||||||
parentItem,
|
parentItem,
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user