]> git.joonet.de Git - adminer.git/commitdiff
Highlight code in <textarea>
authorJakub Vrana <jakub@vrana.cz>
Mon, 22 Jul 2013 18:45:09 +0000 (11:45 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 22 Jul 2013 18:45:09 +0000 (11:45 -0700)
adminer/include/editing.inc.php
adminer/static/editing.js
adminer/static/functions.js
externals/jush

index 81328eca17cd3657a6f1b39d080f3fb84cbe01d9..49b80d171d4a35316dfc87348ea1ead237c910c2 100644 (file)
@@ -117,7 +117,8 @@ function referencable_primary($self) {
 * @return null
 */
 function textarea($name, $value, $rows = 10, $cols = 80) {
-       echo "<textarea name='$name' rows='$rows' cols='$cols' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>"; // spellcheck, wrap - not valid before HTML5
+       global $jush;
+       echo "<textarea name='$name' rows='$rows' cols='$cols' class='sqlarea jush-$jush' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>"; // spellcheck, wrap - not valid before HTML5
        if (is_array($value)) {
                foreach ($value as $val) { // not implode() to save memory
                        echo h($val[0]) . "\n\n\n"; // $val == array($query, $time)
index d1edd275e944ebb6490f25a97362a6f03a3b79e0..4d301de460d741ce85a0553336f062fc0898f0e6 100644 (file)
@@ -27,6 +27,12 @@ function bodyLoad(version) {
                                        jush.custom_links = jushLinks;
                                }
                                jush.highlight_tag('code', 0);
+                               var tags = document.getElementsByTagName('textarea');
+                               for (var i = 0; i < tags.length; i++) {
+                                       if (/(^|\s)jush-/.test(tags[i].className)) {
+                                               jush.textarea(tags[i]);
+                                       }
+                               }
                        }
                };
                script.onreadystatechange = function () {
index 3e8c06832e98f080ba14178af41b328416d0b72a..824ba929b40f8481699179dc8edf62c96eebea2a 100644 (file)
@@ -366,6 +366,9 @@ function getTarget(event) {
 */
 function bodyKeydown(event, button) {
        var target = getTarget(event);
+       if (target.jushTextarea) {
+               target = target.jushTextarea;
+       }
        if (isCtrl(event) && (event.keyCode == 13 || event.keyCode == 10) && isTag(target, 'select|textarea|input')) { // 13|10 - Enter
                target.blur();
                if (button) {
index 9493dcc08e23313562d6860d3fa0592e40ed2cf8..06a7c7d73e2d031a493d1f07d37733aba94399f2 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9493dcc08e23313562d6860d3fa0592e40ed2cf8
+Subproject commit 06a7c7d73e2d031a493d1f07d37733aba94399f2