feat(UX): cancel new row with escape key (#23928)
* feat: (UX) cancel new row with escape key * fix: linters * fix: more linters --------- Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
parent
1fe3b5d5bc
commit
c00d5ac258
1 changed files with 10 additions and 2 deletions
|
|
@ -1135,8 +1135,8 @@ export default class GridRow {
|
|||
let ignore_fieldtypes = ["Text", "Small Text", "Code", "Text Editor", "HTML Editor"];
|
||||
if (field.$input) {
|
||||
field.$input.on("keydown", function (e) {
|
||||
var { TAB, UP: UP_ARROW, DOWN: DOWN_ARROW } = frappe.ui.keyCode;
|
||||
if (![TAB, UP_ARROW, DOWN_ARROW].includes(e.which)) {
|
||||
var { ESCAPE, TAB, UP: UP_ARROW, DOWN: DOWN_ARROW } = frappe.ui.keyCode;
|
||||
if (![TAB, UP_ARROW, DOWN_ARROW, ESCAPE].includes(e.which)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1171,6 +1171,14 @@ export default class GridRow {
|
|||
return true;
|
||||
};
|
||||
|
||||
// ESC
|
||||
if (e.which === ESCAPE && !e.shiftKey) {
|
||||
if (me.doc.__unedited) {
|
||||
me.grid.grid_rows[me.doc.idx - 1].remove();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// TAB
|
||||
if (e.which === TAB && !e.shiftKey) {
|
||||
var last_column = me.wrapper.find(":input:enabled:last").get(0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue