mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
Highlight code in <textarea>
This commit is contained in:
@@ -117,7 +117,8 @@ function referencable_primary($self) {
|
|||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function textarea($name, $value, $rows = 10, $cols = 80) {
|
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)) {
|
if (is_array($value)) {
|
||||||
foreach ($value as $val) { // not implode() to save memory
|
foreach ($value as $val) { // not implode() to save memory
|
||||||
echo h($val[0]) . "\n\n\n"; // $val == array($query, $time)
|
echo h($val[0]) . "\n\n\n"; // $val == array($query, $time)
|
||||||
|
@@ -27,6 +27,12 @@ function bodyLoad(version) {
|
|||||||
jush.custom_links = jushLinks;
|
jush.custom_links = jushLinks;
|
||||||
}
|
}
|
||||||
jush.highlight_tag('code', 0);
|
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 () {
|
script.onreadystatechange = function () {
|
||||||
|
@@ -366,6 +366,9 @@ function getTarget(event) {
|
|||||||
*/
|
*/
|
||||||
function bodyKeydown(event, button) {
|
function bodyKeydown(event, button) {
|
||||||
var target = getTarget(event);
|
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
|
if (isCtrl(event) && (event.keyCode == 13 || event.keyCode == 10) && isTag(target, 'select|textarea|input')) { // 13|10 - Enter
|
||||||
target.blur();
|
target.blur();
|
||||||
if (button) {
|
if (button) {
|
||||||
|
2
externals/jush
vendored
2
externals/jush
vendored
Submodule externals/jush updated: 9493dcc08e...06a7c7d73e
Reference in New Issue
Block a user