diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-02-20 10:11:56 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-02-20 10:11:56 +0300 |
commit | 805679626a0028fc1b567c48f7b114d24272f15b (patch) | |
tree | 28d263b0b437bc410151fd1b51778655aaf36c25 /js/transformations | |
parent | de8da9da5fc072a4dd6068f4cf79769564eda9b8 (diff) |
rfe #685 Editor for HTML content
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/transformations')
-rw-r--r-- | js/transformations/xml.js | 20 | ||||
-rw-r--r-- | js/transformations/xml_editor.js | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/js/transformations/xml.js b/js/transformations/xml.js new file mode 100644 index 0000000000..c6ed64b1f1 --- /dev/null +++ b/js/transformations/xml.js @@ -0,0 +1,20 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * XML syntax highlighting transformation plugin + */ +AJAX.registerOnload('transformations/xml.js', function() { + var $elm = $('#page_content').find('code.xml'); + $elm.each(function () { + var $json = $(this); + var $pre = $json.find('pre'); + /* We only care about visible elements to avoid double processing */ + if ($pre.is(":visible")) { + var $highlight = $('<div class="xml-highlight cm-s-default"></div>'); + $json.append($highlight); + if (typeof CodeMirror != 'undefined') { + CodeMirror.runMode($json.text(), 'application/xml', $highlight[0]); + $pre.hide(); + } + } + }); +}); diff --git a/js/transformations/xml_editor.js b/js/transformations/xml_editor.js new file mode 100644 index 0000000000..c10b8f845c --- /dev/null +++ b/js/transformations/xml_editor.js @@ -0,0 +1,16 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * XML editor plugin + * + * @package PhpMyAdmin + */ +AJAX.registerOnload('transformations/xml_editor.js', function() { + $.each($('textarea.transform_xml_editor'), function (i, e) { + CodeMirror.fromTextArea(e, { + lineNumbers: true, + indentUnit: 4, + mode: "application/xml", + lineWrapping: true + }); + }); +}); |