diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-02-19 10:50:32 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-02-19 10:50:32 +0300 |
commit | 6ee59b7eecc6fe5d77f04429c5ba629ff46fdd7f (patch) | |
tree | 632a3e00da5c6fc2d00f78957678847883982c90 /js/transformations | |
parent | c6cb3f0698c68af6de9e16c6095898220112b8b7 (diff) |
rfe CodeMirror based SQL editor as an input transformation
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/transformations')
-rw-r--r-- | js/transformations/sql_editor.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/transformations/sql_editor.js b/js/transformations/sql_editor.js new file mode 100644 index 0000000000..3c7b305a43 --- /dev/null +++ b/js/transformations/sql_editor.js @@ -0,0 +1,30 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * SQL syntax highlighting transformation plugin js + * + * @package PhpMyAdmin + */ +AJAX.registerOnload('transformations/sql_editor.js', function() { + + $.each($('textarea.transform_sql_editor'), function (i, e) { + var height = $(e).css('height'); + var codemirror_editor = CodeMirror.fromTextArea(e, { + lineNumbers: true, + matchBrackets: true, + extraKeys: {"Ctrl-Space": "autocomplete"}, + hintOptions: {"completeSingle": false, "completeOnSingleClick": true}, + indentUnit: 4, + mode: "text/x-mysql", + lineWrapping: true + }); + codemirror_editor.on("inputRead", codemirrorAutocompleteOnInputRead); + codemirror_editor.getScrollerElement().style.height = height; + codemirror_editor.refresh(); + codemirror_editor.focus(); + $(codemirror_editor.getWrapperElement()).bind( + 'keydown', + catchKeypressesFromSqlTextboxes + ); + }); + +}); |