From 09a859d7e3c0fabf7377bf93a9b36baab14c40f6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 18 Jul 2017 17:14:20 -0400 Subject: [PATCH] Allow an array of strings in Zotero.Item::setTags() New tags will all be of type 0 (manual) --- chrome/content/zotero/xpcom/data/item.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index b56978a7c..2b2b72d37 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3372,11 +3372,14 @@ Zotero.Item.prototype.getTagType = function (tagName) { * * A separate save() is required to update the database. * - * @param {Array} tags Tag data in API JSON format (e.g., [{tag: 'tag', type: 1}]) + * @param {String[]|Object[]} tags - Array of strings or object in API JSON format + * (e.g., [{tag: 'tag', type: 1}]) */ Zotero.Item.prototype.setTags = function (tags) { var oldTags = this.getTags(); - var newTags = tags.concat(); + var newTags = tags.concat() + // Allow array of strings + .map(tag => typeof tag == 'string' ? { tag } : tag); for (let i=0; i