diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index e4db3c24f..f79a2f84c 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -647,16 +647,22 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient) } else if (dataType == 'zotero/item') { var ids = data.data.split(','); - var targetCollection = this._getItemAtRow(row).ref; - for each(var id in ids) - { - var item = Zotero.Items.get(id); + if (ids.length < 1) { + return; + } + + var toAdd = []; + for (var i=0; i 0) { + this._getItemAtRow(row).ref.addItems(toAdd); + } } else if (dataType == 'text/x-moz-url') { var url = data.data.split("\n")[0]; diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index 9b11a9520..fe3032dca 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -3013,6 +3013,22 @@ Zotero.Collection.prototype.addItem = function(itemID){ } +/** + * Add multiple items to the collection in batch + */ +Zotero.Collection.prototype.addItems = function(itemIDs) { + if (!itemIDs || !itemIDs.length) { + return; + } + + Zotero.DB.beginTransaction(); + for (var i=0; i