Don't break integration if QuickFormat dialog is closed with close box (only affects Linux)
This commit is contained in:
parent
c1672e4d4e
commit
42e69dbf97
|
@ -29,7 +29,7 @@ var Zotero_QuickFormat = new function () {
|
||||||
showEditor, referencePanel, referenceBox, referenceHeight = 0, separatorHeight = 0,
|
showEditor, referencePanel, referenceBox, referenceHeight = 0, separatorHeight = 0,
|
||||||
currentLocator, currentLocatorLabel, currentSearchTime, dragging, panel,
|
currentLocator, currentLocatorLabel, currentSearchTime, dragging, panel,
|
||||||
panelPrefix, panelSuffix, panelSuppressAuthor, panelLocatorLabel, panelLocator, panelInfo,
|
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
|
// A variable that contains the timeout object for the latest onKeyPress event
|
||||||
var eventTimeout = null;
|
var eventTimeout = null;
|
||||||
|
@ -918,9 +918,25 @@ var Zotero_QuickFormat = new function () {
|
||||||
* Accepts current selection and adds citation
|
* Accepts current selection and adds citation
|
||||||
*/
|
*/
|
||||||
function _accept() {
|
function _accept() {
|
||||||
|
if(accepted) return;
|
||||||
|
accepted = true;
|
||||||
|
try {
|
||||||
_updateCitationObject();
|
_updateCitationObject();
|
||||||
document.getElementById("quick-format-deck").selectedIndex = 1;
|
document.getElementById("quick-format-deck").selectedIndex = 1;
|
||||||
io.accept(_onProgress);
|
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) {
|
this.onKeyPress = function(event) {
|
||||||
var keyCode = event.keyCode;
|
var keyCode = event.keyCode;
|
||||||
if(keyCode === event.DOM_VK_ESCAPE) {
|
if(keyCode === event.DOM_VK_ESCAPE && !accepted) {
|
||||||
|
accepted = true;
|
||||||
io.citation.citationItems = [];
|
io.citation.citationItems = [];
|
||||||
io.accept();
|
io.accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
persist="screenX screenY"
|
persist="screenX screenY"
|
||||||
onkeypress="Zotero_QuickFormat.onKeyPress(event)">
|
onkeypress="Zotero_QuickFormat.onKeyPress(event)"
|
||||||
|
onunload="Zotero_QuickFormat.onUnload()">
|
||||||
|
|
||||||
<script src="../include.js"/>
|
<script src="../include.js"/>
|
||||||
<script src="windowDraggingUtils.js" type="text/javascript;version=1.8"/>
|
<script src="windowDraggingUtils.js" type="text/javascript;version=1.8"/>
|
||||||
|
|
|
@ -1387,7 +1387,7 @@ Zotero.Integration.Fields.prototype.addEditCitation = function(field, callback)
|
||||||
var field = this.addField(true);
|
var field = this.addField(true);
|
||||||
field.setCode("TEMP");
|
field.setCode("TEMP");
|
||||||
|
|
||||||
citation = {"citationItems":{}, "properties":{}};
|
citation = {"citationItems":[], "properties":{}};
|
||||||
}
|
}
|
||||||
|
|
||||||
var io = new Zotero.Integration.CitationEditInterface(citation, field, this, session, newField, callback);
|
var io = new Zotero.Integration.CitationEditInterface(citation, field, this, session, newField, callback);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user