www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 6c8cf71c9ad9509b6210cb8b1fcb99a334600277
parent 16ad422e89ed402421787ad06ba871cdd4ebb0f7
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri,  9 Mar 2018 06:39:27 -0500

Select parent item after metadata retrieval if only PDF was selected

TODO: select all parents

Diffstat:
Mchrome/content/zotero/xpcom/recognizePDF.js | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/recognizePDF.js b/chrome/content/zotero/xpcom/recognizePDF.js @@ -349,6 +349,16 @@ Zotero.RecognizePDF = new function () { 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); if (!parentItem) { return null; @@ -387,6 +397,18 @@ Zotero.RecognizePDF = new function () { await attachment.saveTx(); } + try { + zp = Zotero.getActiveZoteroPane(); + if (zp) { + if (selectParent) { + await zp.selectItem(parentItem.id); + } + } + } + catch (e) { + Zotero.logError(e); + } + _newItems.set( parentItem, {