From 756ae599e92cdd1aa0a319c189663fbadc709753 Mon Sep 17 00:00:00 2001 From: Aris Feryanto Date: Fri, 22 Jul 2011 12:04:47 +0800 Subject: [PATCH] Grid edit: press escape key anywhere to cancel editing --- js/makegrid.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/makegrid.js b/js/makegrid.js index 06a83f7734..dadd678aae 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -1253,10 +1253,7 @@ } }); $(g.cEdit).keydown(function(e) { - if (e.which == 27) { - // cancel on pressing "Esc" - g.hideEditCell(true); - } else if (!g.isEditCellTextEditable) { + if (!g.isEditCellTextEditable) { // prevent text editing e.preventDefault(); } @@ -1267,6 +1264,12 @@ g.hideEditCell(); } }); + $('html').keydown(function(e) { + if (e.which == 27 && g.isCellEditActive) { + // cancel on pressing "Esc" + g.hideEditCell(true); + } + }); // add table class $(t).addClass('pma_table');