changeset 18aa5187ac6f in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=18aa5187ac6f
description:
Manage escape key on UniqueDialog
On escape key pressed, we call close method and reject the promise like
a
cancel.
issue8947
review266611002
diffstat:
src/common.js | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r 5d2f72767b41 -r 18aa5187ac6f src/common.js
--- a/src/common.js Thu Jan 09 22:35:55 2020 +0100
+++ b/src/common.js Mon Jan 13 23:51:27 2020 +0100
@@ -2852,7 +2852,7 @@
this.running = false;
},
build_dialog: function() {
- var dialog = new Sao.Dialog('', this.class_);
+ var dialog = new Sao.Dialog('', this.class_, undefined, false);
return dialog;
},
run: function() {
@@ -2873,6 +2873,12 @@
dialog.modal.find('input,select')
.filter(':visible').first().focus();
});
+ dialog.modal.on('keydown', function(e) {
+ if (e.which == Sao.common.ESC_KEYCODE) {
+ this.close(dialog);
+ prm.reject();
+ }
+ }.bind(this));
return prm;
},
close: function(dialog) {