commit 4a06be2490b6702adf0fc767881f0483a803a0ee
parent be38be66f74b265258c6c02ec9d28ddbed2b7e06
Author: Simon Kornblith <simon@simonster.com>
Date: Sun, 29 Jan 2012 16:40:14 -0500
Merge branch '3.0'
Diffstat:
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js
@@ -29,7 +29,7 @@ var Zotero_QuickFormat = new function () {
showEditor, referencePanel, referenceBox, referenceHeight = 0, separatorHeight = 0,
currentLocator, currentLocatorLabel, currentSearchTime, dragging, panel,
panelPrefix, panelSuffix, panelSuppressAuthor, panelLocatorLabel, panelLocator, panelInfo,
- panelRefersToBubble, panelFrameHeight = 0;
+ panelRefersToBubble, panelFrameHeight = 0, accepted = false;
// A variable that contains the timeout object for the latest onKeyPress event
var eventTimeout = null;
@@ -918,9 +918,25 @@ var Zotero_QuickFormat = new function () {
* Accepts current selection and adds citation
*/
function _accept() {
- _updateCitationObject();
- document.getElementById("quick-format-deck").selectedIndex = 1;
- io.accept(_onProgress);
+ if(accepted) return;
+ accepted = true;
+ try {
+ _updateCitationObject();
+ document.getElementById("quick-format-deck").selectedIndex = 1;
+ io.accept(_onProgress);
+ } catch(e) {
+ Zotero.debug(e);
+ }
+ }
+
+ /**
+ * Handles windows closed with the close box
+ */
+ this.onUnload = function() {
+ if(accepted) return;
+ accepted = true;
+ io.citation.citationItems = [];
+ io.accept();
}
/**
@@ -928,7 +944,8 @@ var Zotero_QuickFormat = new function () {
*/
this.onKeyPress = function(event) {
var keyCode = event.keyCode;
- if(keyCode === event.DOM_VK_ESCAPE) {
+ if(keyCode === event.DOM_VK_ESCAPE && !accepted) {
+ accepted = true;
io.citation.citationItems = [];
io.accept();
}
diff --git a/chrome/content/zotero/integration/quickFormat.xul b/chrome/content/zotero/integration/quickFormat.xul
@@ -37,7 +37,8 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
persist="screenX screenY"
- onkeypress="Zotero_QuickFormat.onKeyPress(event)">
+ onkeypress="Zotero_QuickFormat.onKeyPress(event)"
+ onunload="Zotero_QuickFormat.onUnload()">
<script src="../include.js"/>
<script src="windowDraggingUtils.js" type="text/javascript;version=1.8"/>
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
@@ -1387,7 +1387,7 @@ Zotero.Integration.Fields.prototype.addEditCitation = function(field, callback)
var field = this.addField(true);
field.setCode("TEMP");
- citation = {"citationItems":{}, "properties":{}};
+ citation = {"citationItems":[], "properties":{}};
}
var io = new Zotero.Integration.CitationEditInterface(citation, field, this, session, newField, callback);