From 1c28a23aa64377cb3347d5a2bab19488d72795ca Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 6 Feb 2012 19:28:49 -0500 Subject: [PATCH] Wait to load all citations out of document before showing QuickFormat dialog if storeReferences is disabled. Otherwise people with missing references apparently get confused. --- chrome/content/zotero/xpcom/integration.js | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index adccd624b..307d18249 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1637,15 +1637,27 @@ Zotero.Integration.Fields.prototype.addEditCitation = function(field, callback) var io = new Zotero.Integration.CitationEditInterface(citation, field, this, session, newField, callback); - if(Zotero.Prefs.get("integration.useClassicAddCitationDialog")) { - Zotero.Integration.displayDialog(this._doc, - 'chrome://zotero/content/integration/addCitationDialog.xul', 'alwaysRaised,resizable', - io, true); + var doc = this._doc; + function openAddCitationDialog() { + if(Zotero.Prefs.get("integration.useClassicAddCitationDialog")) { + Zotero.Integration.displayDialog(doc, + 'chrome://zotero/content/integration/addCitationDialog.xul', 'alwaysRaised,resizable', + io, true); + } else { + var mode = (!Zotero.isMac && Zotero.Prefs.get('integration.keepAddCitationDialogRaised') + ? 'popup' : 'alwaysRaised') + Zotero.Integration.displayDialog(doc, + 'chrome://zotero/content/integration/quickFormat.xul', mode, io, true); + } + } + + if(session.data.prefs.storeReferences) { + // If references are stored in document, don't delay opening dialog to see if there are + // missing references + openAddCitationDialog(); } else { - var mode = (!Zotero.isMac && Zotero.Prefs.get('integration.keepAddCitationDialogRaised') - ? 'popup' : 'alwaysRaised') - Zotero.Integration.displayDialog(this._doc, - 'chrome://zotero/content/integration/quickFormat.xul', mode, io, true); + // Otherwise, read items out of the document before doing anything + io._runWhenSessionUpdated(openAddCitationDialog); } }