diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-06-15 12:49:27 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-06-15 12:49:27 +0300 |
commit | c2e91186d280230a84cf44fb94d47ff95478170d (patch) | |
tree | 1f6dc587b76d2b288ee5a83c070cd4946fa04f28 /js/functions.js | |
parent | e3449c9372be31736c94ac1eb4ecbfe6404c7103 (diff) |
Allow specifying resize direction
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/functions.js')
-rw-r--r-- | js/functions.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/js/functions.js b/js/functions.js index 662cc0ffea..44e37cb7de 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()); } |