diff --git a/js/db_qbe.js b/js/db_qbe.js index a9b0fa0d7825..aa7ffe4e60ad 100644 --- a/js/db_qbe.js +++ b/js/db_qbe.js @@ -28,7 +28,7 @@ AJAX.registerTeardown('db_qbe.js', function () { AJAX.registerOnload('db_qbe.js', function () { - PMA_getSQLEditor($('#textSqlquery')); + PMA_getSQLEditor($('#textSqlquery'), {}, 'both'); /** * Ajax event handlers for 'Select saved search' diff --git a/js/functions.js b/js/functions.js index 662cc0ffeabf..44e37cb7de77 100644 --- a/js/functions.js +++ b/js/functions.js @@ -102,8 +102,9 @@ $.ajaxPrefilter(function (options, originalOptions, jqXHR) { * * @param $textarea jQuery object wrapping the textarea to be made the editor * @param options optional options for CodeMirror + * @param resize optional resizing ('vertical', 'horizontal', 'both') */ -function PMA_getSQLEditor($textarea, options) { +function PMA_getSQLEditor($textarea, options, resize) { if ($textarea.length > 0 && typeof CodeMirror !== 'undefined') { // merge options for CodeMirror @@ -121,10 +122,23 @@ function PMA_getSQLEditor($textarea, options) { // create CodeMirror editor var codemirrorEditor = CodeMirror.fromTextArea($textarea[0], defaults); // allow resizing + if (! resize) { + resize = 'vertical'; + } + var handles = ''; + if (resize == 'vertical') { + handles = 'n, s'; + } + if (resize == 'both') { + handles = 'all'; + } + if (resize == 'horizontal') { + handles = 'e, w'; + } $(codemirrorEditor.getWrapperElement()) - .css('resize', 'vertical') + .css('resize', resize) .resizable({ - handles: 'n, s', + handles: handles, resize: function() { codemirrorEditor.setSize($(this).width(), $(this).height()); } diff --git a/js/transformations/sql_editor.js b/js/transformations/sql_editor.js index cfb4d82816bd..83e560e88d3c 100644 --- a/js/transformations/sql_editor.js +++ b/js/transformations/sql_editor.js @@ -7,6 +7,6 @@ AJAX.registerOnload('transformations/sql_editor.js', function() { $('textarea.transform_sql_editor').each(function () { - PMA_getSQLEditor($(this)); + PMA_getSQLEditor($(this), {}, 'both'); }); });