moved escapeKey handler to global scope (to prevent only said handler from executing when a dialog is closed)
This commit is contained in:
parent
07149d4083
commit
e563885de1
@ -289,7 +289,6 @@ function SqlExporterDialog(options) {
|
||||
this._elmts.cancelButton.click(function() { self._dismiss(); });
|
||||
this._elmts.downloadButton.click(function() { self._download(); });
|
||||
this._elmts.downloadPreviewButton.click(function(evt) { self._previewDownload(); });
|
||||
|
||||
this._configureUIFromOptionCode(options);
|
||||
this._updateOptionCode();
|
||||
};
|
||||
|
@ -35,6 +35,13 @@ DialogSystem = {
|
||||
_layers: []
|
||||
};
|
||||
|
||||
var escapeKey = function(event) {
|
||||
var level = DialogSystem._layers.length;
|
||||
if (event.keyCode == 27) {
|
||||
DialogSystem.dismissUntil(level - 1);
|
||||
}
|
||||
}
|
||||
|
||||
DialogSystem.showDialog = function(elmt, onCancel) {
|
||||
var overlay = $('<div> </div>')
|
||||
.addClass("dialog-overlay")
|
||||
@ -61,14 +68,8 @@ DialogSystem.showDialog = function(elmt, onCancel) {
|
||||
|
||||
var level = DialogSystem._layers.length;
|
||||
|
||||
|
||||
var escapeKey = function(event) {
|
||||
if (event.keyCode == 27) {
|
||||
DialogSystem.dismissUntil(level - 1);
|
||||
}
|
||||
}
|
||||
$(window).keydown(escapeKey);
|
||||
|
||||
|
||||
return level;
|
||||
};
|
||||
|
||||
@ -98,15 +99,12 @@ DialogSystem.dismissUntil = function(level) {
|
||||
for (var i = DialogSystem._layers.length - 1; i >= level; i--) {
|
||||
DialogSystem.dismissLevel(i);
|
||||
}
|
||||
$(window).off('keydown');
|
||||
$(window).off('keydown', escapeKey);
|
||||
DialogSystem._layers = DialogSystem._layers.slice(0, level);
|
||||
|
||||
};
|
||||
|
||||
DialogSystem.createDialog = function() {
|
||||
|
||||
return $('<div></div>').addClass("dialog-frame");
|
||||
|
||||
};
|
||||
|
||||
DialogSystem.showBusy = function(message) {
|
||||
|
Loading…
Reference in New Issue
Block a user