Fix must insert citation prompt in new doc with copied fields. Closes #1564
This commit is contained in:
parent
6061bbdfd8
commit
66ed33b9fb
1 changed files with 9 additions and 4 deletions
|
@ -267,6 +267,12 @@ Zotero.Integration = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(displayError) {
|
if(displayError) {
|
||||||
|
if (Zotero.Integration.currentSession && Zotero.Integration.currentSession.progressBar) {
|
||||||
|
Zotero.Promise.delay(5).then(function() {
|
||||||
|
Zotero.Integration.currentSession.progressBar.hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var showErrorInFirefox = !document;
|
var showErrorInFirefox = !document;
|
||||||
|
|
||||||
if(document) {
|
if(document) {
|
||||||
|
@ -1393,20 +1399,19 @@ Zotero.Integration.Session.prototype.init = Zotero.Promise.coroutine(function *(
|
||||||
var data = this.data;
|
var data = this.data;
|
||||||
var haveFields = false;
|
var haveFields = false;
|
||||||
|
|
||||||
// If prefs exist
|
// If prefs not present
|
||||||
if (require && data.prefs.fieldType) {
|
if (require && !data.prefs.fieldType) {
|
||||||
// check to see if fields already exist
|
// check to see if fields already exist
|
||||||
for (let fieldType of [this.primaryFieldType, this.secondaryFieldType]) {
|
for (let fieldType of [this.primaryFieldType, this.secondaryFieldType]) {
|
||||||
var fields = yield this._doc.getFields(fieldType);
|
var fields = yield this._doc.getFields(fieldType);
|
||||||
if (fields.length) {
|
if (fields.length) {
|
||||||
data.prefs.fieldType = fieldType;
|
|
||||||
haveFields = true;
|
haveFields = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require && (!haveFields || !data.prefs.fieldType)) {
|
if (require && (!haveFields && !data.prefs.fieldType)) {
|
||||||
// If required but no fields and preferences exist throw an error
|
// If required but no fields and preferences exist throw an error
|
||||||
return Zotero.Promise.reject(new Zotero.Exception.Alert(
|
return Zotero.Promise.reject(new Zotero.Exception.Alert(
|
||||||
"integration.error.mustInsertCitation",
|
"integration.error.mustInsertCitation",
|
||||||
|
|
Loading…
Reference in a new issue