From 66ed33b9fbe511c5565e4d0529744c8072483b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Tue, 4 Sep 2018 16:37:23 +0300 Subject: [PATCH] Fix must insert citation prompt in new doc with copied fields. Closes #1564 --- chrome/content/zotero/xpcom/integration.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 31c4acb865..d5746e92be 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -267,6 +267,12 @@ Zotero.Integration = new function() { } if(displayError) { + if (Zotero.Integration.currentSession && Zotero.Integration.currentSession.progressBar) { + Zotero.Promise.delay(5).then(function() { + Zotero.Integration.currentSession.progressBar.hide(); + }); + } + var showErrorInFirefox = !document; if(document) { @@ -1393,20 +1399,19 @@ Zotero.Integration.Session.prototype.init = Zotero.Promise.coroutine(function *( var data = this.data; var haveFields = false; - // If prefs exist - if (require && data.prefs.fieldType) { + // If prefs not present + if (require && !data.prefs.fieldType) { // check to see if fields already exist for (let fieldType of [this.primaryFieldType, this.secondaryFieldType]) { var fields = yield this._doc.getFields(fieldType); if (fields.length) { - data.prefs.fieldType = fieldType; haveFields = true; break; } } } - if (require && (!haveFields || !data.prefs.fieldType)) { + if (require && (!haveFields && !data.prefs.fieldType)) { // If required but no fields and preferences exist throw an error return Zotero.Promise.reject(new Zotero.Exception.Alert( "integration.error.mustInsertCitation",