Skip to content
Browse files

Use Esc to disable in-place edit (bug #3299578)

  • Loading branch information...
1 parent 9bb7641 commit fcc773660ec7d582be87ec2eb9226384d571b29a @vrana committed May 10, 2011
Showing with 15 additions and 3 deletions.
  1. +14 −3 adminer/static/functions.js
  2. +1 −0 changes.txt
View
17 adminer/static/functions.js
@@ -384,10 +384,21 @@ function ajaxForm(form, data) {
* @param number display textarea instead of input, 2 - load long text
*/
function selectDblClick(td, event, text) {
- td.ondblclick = function () { };
- var pos = event.rangeOffset;
- var value = (td.firstChild.alt ? td.firstChild.alt : (td.textContent ? td.textContent : td.innerText));
+ if (/input|textarea/i.test(td.firstChild.tagName)) {
+ return;
+ }
+ var original = td.innerHTML;
var input = document.createElement(text ? 'textarea' : 'input');
+ input.onkeydown = function (event) {
+ if (!event) {
+ event = window.event;
+ }
+ if (event.keyCode == 27 && !(event.ctrlKey || event.shiftKey || event.altKey || event.metaKey)) { // 27 - Esc
+ td.innerHTML = original;
+ }
+ };
+ var pos = event.rangeOffset;
+ var value = td.firstChild.alt || td.textContent || td.innerText;
input.style.width = Math.max(td.clientWidth - 14, 20) + 'px'; // 14 = 2 * (td.border + td.padding + input.border)
if (text) {
var rows = 1;
View
1 changes.txt
@@ -1,4 +1,5 @@
Adminer 3.3.0-dev:
+Use Esc to disable in-place edit
Highlight SQL code in textarea
Append new index with auto index selection (bug #3282127)
Autocomplete for big foreign keys (Editor)

0 comments on commit fcc7736

Please sign in to comment.
Something went wrong with that request. Please try again.