From a67c90a0d86907a2ac5c2b79a7933f6708ba720b Mon Sep 17 00:00:00 2001 From: jous Date: Wed, 9 Jan 2013 01:23:38 +0200 Subject: [PATCH] first fix for sql query autofocus and submitting the query with ctrl-enter --- js/functions.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/functions.js b/js/functions.js index c76b4d6881..e8041ec07c 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1423,12 +1423,6 @@ AJAX.registerOnload('functions.js', function() { } }); - $('#sqlquery').focus().keydown(function (e) { - if (e.ctrlKey && e.keyCode == 13) { - $("#sqlqueryform").submit(); - } - }); - if ($('#input_username')) { if ($('#input_username').val() == '') { $('#input_username').focus(); @@ -3385,8 +3379,15 @@ AJAX.registerOnload('functions.js', function() { matchBrackets: true, indentUnit: 4, mode: "text/x-mysql", - lineWrapping: true + lineWrapping: true, + onKeyEvent: function (inst, e) { + if (e.type == 'keydown' && e.ctrlKey && (e.keyCode == 13 || e.keyCode == 10)) { + $("#button_submit_query").submit(); + return false; + } + } }); + codemirror_editor.focus(); } }); AJAX.registerTeardown('functions.js', function() {