diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php
index 97936e3c..b5ee145f 100644
--- a/adminer/include/editing.inc.php
+++ b/adminer/include/editing.inc.php
@@ -231,7 +231,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
"; ?>
- $field) {
$i++;
$orig = $field[($_POST ? "orig" : "field")];
diff --git a/adminer/static/editing.js b/adminer/static/editing.js
index 9d4b9446..03006d1d 100644
--- a/adminer/static/editing.js
+++ b/adminer/static/editing.js
@@ -240,6 +240,33 @@ function editingLengthBlur(edit) {
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
* @param boolean
* @param number
diff --git a/changes.txt b/changes.txt
index 2d1676e6..fd9d508c 100644
--- a/changes.txt
+++ b/changes.txt
@@ -7,6 +7,7 @@ History: edit all
MS SQL: auto primary and foreign key
SQLite: display 0
Create table default data type: int
+Create table keyboard shortcuts: Ctrl+Up, Ctrl+Down
Homepage customization
Use IN for search in numeric fields (Editor)
Work without session.use_cookies (bug #3138640)
|