Ctrl+Up and Down in edit and in-place edit
This commit is contained in:
parent
0926122e14
commit
241fc4ef6c
|
@ -67,7 +67,7 @@ if ($_POST["save"]) {
|
||||||
<form action="" method="post" enctype="multipart/form-data">
|
<form action="" method="post" enctype="multipart/form-data">
|
||||||
<?php
|
<?php
|
||||||
if ($fields) {
|
if ($fields) {
|
||||||
echo "<table cellspacing='0'>\n";
|
echo "<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
echo "<tr><th>" . $adminer->fieldName($field);
|
echo "<tr><th>" . $adminer->fieldName($field);
|
||||||
$default = $_GET["set"][bracket_escape($name)];
|
$default = $_GET["set"][bracket_escape($name)];
|
||||||
|
|
|
@ -251,7 +251,7 @@ if (!$columns) {
|
||||||
} else {
|
} else {
|
||||||
$backward_keys = $adminer->backwardKeys($TABLE, $table_name);
|
$backward_keys = $adminer->backwardKeys($TABLE, $table_name);
|
||||||
|
|
||||||
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
|
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n";
|
||||||
echo "<thead><tr>" . (!$group && $select ? "" : "<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>");
|
echo "<thead><tr>" . (!$group && $select ? "" : "<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>");
|
||||||
$names = array();
|
$names = array();
|
||||||
$functions = array();
|
$functions = array();
|
||||||
|
|
|
@ -240,33 +240,6 @@ function editingLengthBlur(edit) {
|
||||||
edit.style.display = 'none';
|
edit.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Find node position
|
|
||||||
* @param Node
|
|
||||||
* @return number
|
|
||||||
*/
|
|
||||||
function nodePosition(el) {
|
|
||||||
var pos = 0;
|
|
||||||
while (el = el.previousSibling) {
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Change focus by Ctrl+Up or Down
|
|
||||||
* @param KeyboardEvent
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
function editingKeydown(event) {
|
|
||||||
var target = event.target || event.srcElement;
|
|
||||||
if ((event.keyCode == 40 || event.keyCode == 38) && event.ctrlKey && !event.altKey && !event.metaKey) { // shiftKey allowed
|
|
||||||
if ((el = target.parentNode.parentNode[(event.keyCode == 40 ? 'nextSibling' : 'previousSibling')]) && (el = el.childNodes[nodePosition(target.parentNode)]) && (el = el.childNodes[nodePosition(target)])) {
|
|
||||||
el.focus();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Show or hide selected table column
|
/** Show or hide selected table column
|
||||||
* @param boolean
|
* @param boolean
|
||||||
* @param number
|
* @param number
|
||||||
|
|
|
@ -107,6 +107,18 @@ function setHtml(id, html) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Find node position
|
||||||
|
* @param Node
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
|
function nodePosition(el) {
|
||||||
|
var pos = 0;
|
||||||
|
while (el = el.previousSibling) {
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
/** Go to the specified page
|
/** Go to the specified page
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
|
@ -177,6 +189,25 @@ function textareaKeypress(target, event, tab, button) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Change focus by Ctrl+Up or Ctrl+Down
|
||||||
|
* @param KeyboardEvent
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function editingKeydown(event) {
|
||||||
|
if ((event.keyCode == 40 || event.keyCode == 38) && event.ctrlKey && !event.altKey && !event.metaKey) { // shiftKey allowed
|
||||||
|
var target = event.target || event.srcElement;
|
||||||
|
var sibling = (event.keyCode == 40 ? 'nextSibling' : 'previousSibling');
|
||||||
|
var el = target.parentNode.parentNode[sibling];
|
||||||
|
if (el && (/^tr$/i.test(el.tagName) || (el = el[sibling])) && /^tr$/i.test(el.tagName) && (el = el.childNodes[nodePosition(target.parentNode)]) && (el = el.childNodes[nodePosition(target)])) {
|
||||||
|
el.focus();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Create AJAX request
|
/** Create AJAX request
|
||||||
* @param string
|
* @param string
|
||||||
* @param function (text)
|
* @param function (text)
|
||||||
|
|
|
@ -7,7 +7,7 @@ History: edit all
|
||||||
MS SQL: auto primary and foreign key
|
MS SQL: auto primary and foreign key
|
||||||
SQLite: display 0
|
SQLite: display 0
|
||||||
Create table default data type: int
|
Create table default data type: int
|
||||||
Create table keyboard shortcuts: Ctrl+Up, Ctrl+Down
|
Focus upper/lower fields by Ctrl+Up/Ctrl+Down
|
||||||
Homepage customization
|
Homepage customization
|
||||||
Use IN for search in numeric fields (Editor)
|
Use IN for search in numeric fields (Editor)
|
||||||
Use password input for _md5 and _sha1 fields (Editor)
|
Use password input for _md5 and _sha1 fields (Editor)
|
||||||
|
|
Loading…
Reference in a new issue