diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 895741fde..4d10ab9ed 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3737,6 +3737,7 @@ Zotero.Item.prototype.multiDiff = Zotero.Promise.coroutine(function* (otherItems * * @param {Number} [libraryID] - libraryID of the new item, or the same as original if omitted * @param {Boolean} [skipTags=false] - Skip tags + * @return {Promise} */ Zotero.Item.prototype.clone = Zotero.Promise.coroutine(function* (libraryID, skipTags) { Zotero.debug('Cloning item ' + this.id); diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index ee73d2b82..372b9807a 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1548,19 +1548,12 @@ var ZoteroPane = new function() var item = self.getSelectedItems()[0]; var newItem; - yield Zotero.DB.executeTransaction(function () { - // Create new unsaved clone item in target library - newItem = new Zotero.Item(item.itemTypeID); - newItem.libraryID = item.libraryID; - // DEBUG: save here because clone() doesn't currently work on unsaved tagged items - var id = yield newItem.save(); - - var newItem = yield Zotero.Items.getAsync(id); - yield item.clone(false, newItem, false, !Zotero.Prefs.get('groups.copyTags')); + yield Zotero.DB.executeTransaction(function* () { + newItem = yield item.clone(null, !Zotero.Prefs.get('groups.copyTags')); yield newItem.save(); if (self.collectionsView.selectedTreeRow.isCollection() && newItem.isTopLevelItem()) { - self.collectionsView.selectedTreeRow.ref.addItem(newItem.id); + yield self.collectionsView.selectedTreeRow.ref.addItem(newItem.id); } });