From d96ebad82a62716ea65b10a46eed9f14b0a5ba9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Mon, 25 Apr 2022 13:28:00 +0300 Subject: [PATCH] Allow adding multiple sources at once in classic citation dialog. Closes #2568 --- .../content/zotero/integration/addCitationDialog.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index 4503e1ba5f..db25f5cab9 100644 --- a/chrome/content/zotero/integration/addCitationDialog.js +++ b/chrome/content/zotero/integration/addCitationDialog.js @@ -376,9 +376,9 @@ var Zotero_Citation_Dialog = new function () { this.add = Zotero.Promise.coroutine(function* (first_item) { var pos, len; - var item = itemsView.getSelectedItems()[0]; // treeview from xpcom/itemTreeView.js + var items = itemsView.getSelectedItems(); // treeview from xpcom/itemTreeView.js - if (!item) { + if (!items.length) { yield sortCitation(); _updateAccept(); _updatePreview(); @@ -386,9 +386,11 @@ var Zotero_Citation_Dialog = new function () { } // Add to selection list and generate a new itemDataID for this cite. - var selectionNode = _addItem(item); - var itemDataID = selectionNode.getAttribute("value"); - document.getElementById("add").disabled = !itemDataID; + for (let item of items) { + var selectionNode = _addItem(item); + var itemDataID = selectionNode.getAttribute("value"); + document.getElementById("add").disabled = !itemDataID; + } // Save existing locator and affix field content, if any. if (first_item) {