Skip to content

Commit

Permalink
Refresh citation text upon citation insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
adomasven committed Jan 16, 2018
1 parent b985ef8 commit 2b27e40
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions chrome/content/zotero/xpcom/integration.js
Expand Up @@ -530,12 +530,14 @@ Zotero.Integration.Interface.prototype.addBibliography = Zotero.Promise.coroutin

let field = new Zotero.Integration.BibliographyField(yield this._session.fields.addField());
field.clearCode();
var citationsMode = FORCE_CITATIONS_FALSE;
if(this._session.data.prefs.delayCitationUpdates) {
// Refreshes citeproc state before proceeding
this._session.reload = true;
citationsMode = FORCE_CITATIONS_REGENERATE;
}
yield this._session.fields.updateSession(FORCE_CITATIONS_FALSE);
yield this._session.fields.updateDocument(FORCE_CITATIONS_FALSE, true, false);
yield this._session.fields.updateSession(citationsMode);
yield this._session.fields.updateDocument(citationsMode, true, false);
})

/**
Expand All @@ -561,13 +563,15 @@ Zotero.Integration.Interface.prototype.editBibliography = Zotero.Promise.corouti
[], "integration.error.title");
}
let bibliography = new Zotero.Integration.Bibliography(bibliographyField);
var citationsMode = FORCE_CITATIONS_FALSE;
if(this._session.data.prefs.delayCitationUpdates) {
// Refreshes citeproc state before proceeding
this._session.reload = true;
citationsMode = FORCE_CITATIONS_REGENERATE;
}
yield this._session.fields.updateSession(FORCE_CITATIONS_FALSE);
yield this._session.fields.updateSession(citationsMode);
yield this._session.editBibliography(bibliography);
yield this._session.fields.updateDocument(FORCE_CITATIONS_FALSE, true, false);
yield this._session.fields.updateDocument(citationsMode, true, false);
});


Expand Down Expand Up @@ -598,13 +602,15 @@ Zotero.Integration.Interface.prototype.addEditBibliography = Zotero.Promise.coro
}

let bibliography = new Zotero.Integration.Bibliography(bibliographyField);
var citationsMode = FORCE_CITATIONS_FALSE;
if(this._session.data.prefs.delayCitationUpdates) {
// Refreshes citeproc state before proceeding
this._session.reload = true;
citationsMode = FORCE_CITATIONS_REGENERATE;
}
yield this._session.fields.updateSession(FORCE_CITATIONS_FALSE);
yield this._session.fields.updateSession(citationsMode);
if (!newBibliography) yield this._session.editBibliography(bibliography);
yield this._session.fields.updateDocument(FORCE_CITATIONS_FALSE, true, false);
yield this._session.fields.updateDocument(citationsMode, true, false);
});

/**
Expand Down

0 comments on commit 2b27e40

Please sign in to comment.