Highlight code in <textarea>
This commit is contained in:
parent
aef38b0530
commit
90b09fc60f
|
@ -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)
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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) {
|
||||
|
|
2
externals/jush
vendored
2
externals/jush
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 9493dcc08e23313562d6860d3fa0592e40ed2cf8
|
||||
Subproject commit 06a7c7d73e2d031a493d1f07d37733aba94399f2
|
Loading…
Reference in a new issue