[FIX] [ESC] key closing dialogs when editing a list

bzr revid: xmo@openerp.com-20121031140641-l1nf68jxiye8fyi8
This commit is contained in:
Xavier Morel 2012-10-31 15:06:41 +01:00
parent e9d00c7148
commit b6af4f22cb
1 changed files with 8 additions and 5 deletions

View File

@ -410,15 +410,15 @@ openerp.web.list_editable = function (instance) {
}); });
this.editor.$el.on('keyup keydown', function (e) { this.editor.$el.on('keyup keydown', function (e) {
if (!self.editor.is_editing()) { return; } if (!self.editor.is_editing()) { return true; }
var key = _($.ui.keyCode).chain() var key = _($.ui.keyCode).chain()
.map(function (v, k) { return {name: k, code: v}; }) .map(function (v, k) { return {name: k, code: v}; })
.find(function (o) { return o.code === e.which; }) .find(function (o) { return o.code === e.which; })
.value(); .value();
if (!key) { return; } if (!key) { return true; }
var method = e.type + '_' + key.name; var method = e.type + '_' + key.name;
if (!(method in self)) { return; } if (!(method in self)) { return true; }
self[method](e); return self[method](e);
}); });
}, },
/** /**
@ -446,7 +446,10 @@ openerp.web.list_editable = function (instance) {
keyup_ENTER: function () { keyup_ENTER: function () {
return this._next(); return this._next();
}, },
keyup_ESCAPE: function () { keydown_ESCAPE: function (e) {
return false;
},
keyup_ESCAPE: function (e) {
return this.cancel_edition(); return this.cancel_edition();
}, },
/** /**