Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle keypress instead of keydown (bug #3112458)

  • Loading branch information...
commit 71438d57c3cab6e8541c396e33b2a5321c340e8c 1 parent 293fc0f
@vrana authored
View
2  adminer/database.inc.php
@@ -57,7 +57,7 @@
<p>
<?php
echo ($_POST["add_x"] || strpos($name, "\n")
- ? '<textarea id="name" name="name" rows="10" cols="40" onkeydown="return textareaKeydown(this, event);">' . h($name) . '</textarea><br>'
+ ? '<textarea id="name" name="name" rows="10" cols="40" onkeypress="return textareaKeypress(this, event);">' . h($name) . '</textarea><br>'
: '<input id="name" name="name" value="' . h($name) . '" maxlength="64">'
) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $collate) : "");
?>
View
2  adminer/dump.inc.php
@@ -218,7 +218,7 @@
}
}
} else {
- echo "<tr><td><textarea name='databases' rows='10' cols='20' onkeydown='return textareaKeydown(this, event);'></textarea>";
+ echo "<tr><td><textarea name='databases' rows='10' cols='20' onkeypress='return textareaKeypress(this, event);'></textarea>";
}
}
?>
View
2  adminer/include/editing.inc.php
@@ -104,7 +104,7 @@ function referencable_primary($self) {
* @return null
*/
function textarea($name, $value, $rows = 10, $cols = 80) {
- echo "<textarea name='$name' rows='$rows' cols='$cols' style='width: 98%;' spellcheck='false' onkeydown='return textareaKeydown(this, event, true);'>" . h($value) . "</textarea>"; // spellcheck - not valid before HTML5
+ echo "<textarea name='$name' rows='$rows' cols='$cols' style='width: 98%;' spellcheck='false' onkeypress='return textareaKeypress(this, event, true);'>" . h($value) . "</textarea>"; // spellcheck - not valid before HTML5
}
/** Print table columns for type edit
View
2  adminer/include/functions.inc.php
@@ -649,7 +649,7 @@ function input($field, $value, $function) {
} elseif (ereg('blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) {
echo "<input type='file' name='fields-$name'$onchange>";
} elseif (ereg('text|lob', $field["type"])) {
- echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs onkeydown='return textareaKeydown(this, event);'>" . h($value) . '</textarea>'; // 1.2em - line-height
+ echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs onkeypress='return textareaKeypress(this, event);'>" . h($value) . '</textarea>'; // 1.2em - line-height
} else {
// int(3) is only a display hint
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
View
2  adminer/select.inc.php
@@ -351,7 +351,7 @@
$editable = is_utf8($val) && $rows[$n][$key] == $row[$key] && !$functions[$key];
$text = ereg('text|lob', $field["type"]);
echo (($_GET["modify"] && $editable) || isset($value)
- ? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "' onkeydown='return textareaKeydown(this, event);'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
+ ? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "' onkeypress='return textareaKeypress(this, event);'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
: "<td id='$id' ondblclick=\"" . ($editable ? "selectDblClick(this, event" . ($long ? ", 2" : ($text ? ", 1" : "")) . ")" : "alert('" . h(lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field)
);
}
View
6 adminer/static/functions.js
@@ -152,7 +152,7 @@ function selectAddRow(field) {
* @param HTMLInputElement submit button
* @return boolean
*/
-function textareaKeydown(target, event, tab, button) {
+function textareaKeypress(target, event, tab, button) {
if (tab && event.keyCode == 9 && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
// inspired by http://pallieter.org/Projects/insertTab/
if (target.setSelectionRange) {
@@ -310,8 +310,8 @@ function selectDblClick(td, event, text) {
rows++;
});
input.rows = rows;
- input.onkeydown = function (event) {
- return textareaKeydown(input, event || window.event, false, document.getElementById('save'));
+ input.onkeypress = function (event) {
+ return textareaKeypress(input, event || window.event, false, document.getElementById('save'));
};
}
if (document.selection) {
View
2  editor/include/adminer.inc.php
@@ -274,7 +274,7 @@ function selectEmailPrint($emailFields, $columns) {
echo '<fieldset><legend><a href="#fieldset-email" onclick="return !toggle(\'fieldset-email\');">' . lang('E-mail') . "</a></legend><div id='fieldset-email'" . ($_POST["email_append"] ? "" : " class='hidden'") . ">\n";
echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n";
- echo "<p><textarea name='email_message' rows='15' cols='75' onkeydown='return textareaKeydown(this, event, false, this.form.email);'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n";
+ echo "<p><textarea name='email_message' rows='15' cols='75' onkeypress='return textareaKeypress(this, event, false, this.form.email);'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n";
echo html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
echo "<p>" . lang('Attachments') . ": <input type='file' name='email_files[]' onchange=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">";
echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
Please sign in to comment.
Something went wrong with that request. Please try again.