diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php
index b0252456..8145f3fb 100644
--- a/adminer/include/editing.inc.php
+++ b/adminer/include/editing.inc.php
@@ -266,7 +266,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
$field) {
$i++;
$orig = $field[($_POST ? "orig" : "field")];
@@ -279,18 +279,18 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
- | | | " aria-labelledby="label-default">
" : ""); ?>
";
echo (support("move_col") ?
- " " . script("qsl('input').onclick = partial(editingAddRow, 1);", "")
- . " " . script("qsl('input').onclick = partial(editingMoveRow, 1);", "")
- . " " . script("qsl('input').onclick = partial(editingMoveRow, 0);", "")
+ " "
+ . " "
+ . " "
: "");
- echo ($orig == "" || support("drop_col") ? "" . script("qsl('input').onclick = partial(editingRemoveRow, 'fields\$1[field]');") : "");
+ echo ($orig == "" || support("drop_col") ? "" : "");
}
}
diff --git a/adminer/static/editing.js b/adminer/static/editing.js
index e6ddf74d..1d79a702 100644
--- a/adminer/static/editing.js
+++ b/adminer/static/editing.js
@@ -188,6 +188,42 @@ function idfEscape(s) {
return s.replace(/`/, '``');
}
+
+
+/** Handle clicks on fields editing
+* @param MouseEvent
+* @return boolean false to cancel action
+*/
+function editingClick(event) {
+ var el = getTarget(event);
+ if (!isTag(el, 'input')) {
+ el = parentTag(target, 'label');
+ el = el && qs('input', el);
+ }
+ if (el) {
+ var name = el.name;
+ if (/^add\[/.test(name)) {
+ editingAddRow.call(el, 1);
+ } else if (/^up\[/.test(name)) {
+ editingMoveRow.call(el, 1);
+ } else if (/^down\[/.test(name)) {
+ editingMoveRow.call(el);
+ } else if (/^drop_col\[/.test(name)) {
+ editingRemoveRow.call(el, 'fields\$1[field]');
+ } else {
+ if (name == 'auto_increment_col') {
+ var field = el.form['fields[' + el.value + '][field]'];
+ if (!field.value) {
+ field.value = 'id';
+ field.oninput();
+ }
+ }
+ return;
+ }
+ return false;
+ }
+}
+
/** Detect foreign key
* @this HTMLInputElement
*/
@@ -269,7 +305,7 @@ function editingAddRow(focus) {
}
/** Remove table row for field
-* @param string
+* @param string regular expression replacement
* @return boolean false
* @this HTMLInputElement
*/
@@ -281,16 +317,16 @@ function editingRemoveRow(name) {
}
/** Move table row for field
-* @param boolean direction to move row, true for up or false for down
+* @param [boolean]
* @return boolean false for success
* @this HTMLInputElement
*/
-function editingMoveRow(dir){
+function editingMoveRow(up){
var row = parentTag(this, 'tr');
if (!('nextElementSibling' in row)) {
return true;
}
- row.parentNode.insertBefore(row, dir
+ row.parentNode.insertBefore(row, up
? row.previousElementSibling
: row.nextElementSibling ? row.nextElementSibling.nextElementSibling : row.parentNode.firstChild);
return false;
diff --git a/changes.txt b/changes.txt
index 22b3f5bc..36035ed3 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,6 +1,7 @@
Adminer 4.6.2-dev:
Semi-transparent border on table actions
Shorten JSON values in select (bug #594)
+Speed up alter table (regression from 4.4.0)
PostgreSQL: Fix exporting string default values
PostgreSQL: Fix exporting sequences in PostgreSQL 10
|