Allow citing items in notes with only property

This commit is contained in:
Adomas Venčkauskas 2020-09-28 18:29:33 +03:00 committed by Dan Stillman
parent 787641dc17
commit 1401550230

View file

@ -1247,9 +1247,9 @@ Zotero.Integration.Session.prototype._updateDocument = async function(forceCitat
} }
// Do these operations in reverse in case plug-ins care about order // Do these operations in reverse in case plug-ins care about order
var removeCodeFields = Object.keys(this._removeCodeFields).sort(); var removeCodeFields = Object.keys(this._removeCodeFields).sort((a, b) => b - a);
for (var i=(removeCodeFields.length-1); i>=0; i--) { for (let fieldIndex of removeCodeFields) {
await this._fields[removeCodeFields[i]].removeCode(); await this._fields[fieldIndex].removeCode();
} }
var deleteFields = Object.keys(this._deleteFields).sort((a, b) => b - a); var deleteFields = Object.keys(this._deleteFields).sort((a, b) => b - a);
@ -2766,6 +2766,9 @@ Zotero.Integration.Citation = class {
// get Zotero item // get Zotero item
var zoteroItem = false; var zoteroItem = false;
if ('uri' in citationItem && !('uris' in citationItem)) {
citationItem.uris = [citationItem.uri];
}
if (citationItem.uris) { if (citationItem.uris) {
let itemNeedsUpdate; let itemNeedsUpdate;
[zoteroItem, itemNeedsUpdate] = await Zotero.Integration.currentSession.uriMap.getZoteroItemForURIs(citationItem.uris); [zoteroItem, itemNeedsUpdate] = await Zotero.Integration.currentSession.uriMap.getZoteroItemForURIs(citationItem.uris);