Permalink
Browse files

Move textarea function to editing.*

  • Loading branch information...
1 parent 9929cc6 commit d6ac5f1ad2f739d46082313778859fab95d62309 @vrana committed Jul 13, 2010
Showing with 35 additions and 35 deletions.
  1. +11 −0 adminer/include/editing.inc.php
  2. +0 −11 adminer/include/functions.inc.php
  3. +24 −0 adminer/static/editing.js
  4. +0 −24 adminer/static/functions.js
@@ -96,6 +96,17 @@ function referencable_primary($self) {
return $return;
}
+/** Print SQL <textarea> tag
+* @param string
+* @param int
+* @param int
+* @param string
+* @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);'>" . h($value) . "</textarea>"; // spellcheck - not valid before HTML5
+}
+
/** Print table columns for type edit
* @param string
* @param array
@@ -116,17 +116,6 @@ function html_select($name, $options, $value = "", $onchange = true) {
return $return;
}
-/** Print SQL <textarea> tag
-* @param string
-* @param int
-* @param int
-* @param string
-* @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);'>" . h($value) . "</textarea>"; // spellcheck - not valid before HTML5
-}
-
// other functions
View
@@ -407,3 +407,27 @@ function schemaMouseup(ev) {
cookie('adminer_schema=' + encodeURIComponent(s.substr(1)), 30, '; path="' + location.pathname + location.search + '"');
}
}
+
+/** Handle Tab and Ctrl+Enter in textarea
+* @param HTMLTextAreaElement
+* @param KeyboardEvent
+* @return boolean
+*/
+function textareaKeydown(target, event) {
+ if (event.keyCode == 9 && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
+ // inspired by http://pallieter.org/Projects/insertTab/
+ if (target.setSelectionRange) {
+ var start = target.selectionStart;
+ target.value = target.value.substr(0, start) + '\t' + target.value.substr(target.selectionEnd);
+ target.setSelectionRange(start + 1, start + 1);
+ return false;
+ } else if (target.createTextRange) {
+ document.selection.createRange().text = '\t';
+ return false;
+ }
+ }
+ if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10) && !event.altKey && !event.metaKey) { // shiftKey allowed
+ target.form.submit();
+ }
+ return true;
+}
@@ -123,30 +123,6 @@ function selectAddRow(field) {
-/** Handle Tab and Ctrl+Enter in textarea
-* @param HTMLTextAreaElement
-* @param KeyboardEvent
-* @return boolean
-*/
-function textareaKeydown(target, event) {
- if (event.keyCode == 9 && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
- // inspired by http://pallieter.org/Projects/insertTab/
- if (target.setSelectionRange) {
- var start = target.selectionStart;
- target.value = target.value.substr(0, start) + '\t' + target.value.substr(target.selectionEnd);
- target.setSelectionRange(start + 1, start + 1);
- return false;
- } else if (target.createTextRange) {
- document.selection.createRange().text = '\t';
- return false;
- }
- }
- if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10) && !event.altKey && !event.metaKey) { // shiftKey allowed
- target.form.submit();
- }
- return true;
-}
-
/** Display edit field

0 comments on commit d6ac5f1

Please sign in to comment.