From 31154ea5018cf62912b732610f4b1b712ff902fa Mon Sep 17 00:00:00 2001 From: jous Date: Wed, 9 Jan 2013 15:11:15 +0200 Subject: [PATCH] Added unbindings to ctrl-enter event listeners Changed keypress events to keydown. --- js/functions.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/js/functions.js b/js/functions.js index a54d1aec5d..2058d6467b 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1315,12 +1315,17 @@ AJAX.registerTeardown('functions.js', function() { $('input.sqlbutton').unbind('click'); $("#export_type").unbind('change'); $('#sqlquery').unbind('keydown'); + $('#sql_query_edit').unbind('keydown'); if (codemirror_inline_editor) { // Copy the sql query to the text area to preserve it. $('#sql_query_edit').text(codemirror_inline_editor.getValue()); codemirror_inline_editor.toTextArea(); codemirror_inline_editor = false; + $(codemirror_inline_editor.getWrapperElement()).unbind('keydown'); + } + if (codemirror_editor) { + $(codemirror_editor.getWrapperElement()).unbind('keydown'); } }); @@ -1450,10 +1455,10 @@ function bindCodeMirrorToInlineEditor() { codemirror_inline_editor.getScrollerElement().style.height = height; codemirror_inline_editor.refresh(); codemirror_inline_editor.focus(); - $(codemirror_inline_editor.getWrapperElement()).bind('keypress', catchKeypressesFromSqlTextboxes); + $(codemirror_inline_editor.getWrapperElement()).bind('keydown', catchKeypressesFromSqlTextboxes); } else { $inline_editor.focus(); - $inline_editor.bind('keypress', catchKeypressesFromSqlTextboxes); + $inline_editor.bind('keydown', catchKeypressesFromSqlTextboxes); } } } @@ -3402,18 +3407,15 @@ AJAX.registerOnload('functions.js', function() { lineWrapping: true }); codemirror_editor.focus(); - $(codemirror_editor.getWrapperElement()).bind('keypress', catchKeypressesFromSqlTextboxes); + $(codemirror_editor.getWrapperElement()).bind('keydown', catchKeypressesFromSqlTextboxes); return false; // without codemirror } else { $elm.focus(); - $($elm).bind('keypress', catchKeypressesFromSqlTextboxes); + $($elm).bind('keydown', catchKeypressesFromSqlTextboxes); } } }); - - - AJAX.registerTeardown('functions.js', function() { if (codemirror_editor) { $('#sqlquery').text(codemirror_editor.getValue());