Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2017-11-28 12:19:23 +0300
committerMichal Čihař <michal@cihar.com>2017-11-28 12:20:30 +0300
commit784fbcd38ffe78d1db26239cdbc7a5bee677fc40 (patch)
tree818912cfd57adfe764f7f417d8299f920b86a2a4 /js/ajax.js
parentca7441de6ce65ea0a16eb25348835996d2c01110 (diff)
Lock page when changes are done in the SQL editor
The CodeMirror does not update underlying textarea in all cases, so we need to handle it directly. Fixes #13821 Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'js/ajax.js')
-rw-r--r--js/ajax.js47
1 files changed, 28 insertions, 19 deletions
diff --git a/js/ajax.js b/js/ajax.js
index e2a0cebcdf..7f4ab70678 100644
--- a/js/ajax.js
+++ b/js/ajax.js
@@ -139,28 +139,37 @@ var AJAX = {
*
* @return void
*/
- lockPageHandler: function(event) {
- //Don't lock on enter.
- if (0 === event.charCode) {
- return;
- }
-
- var lockId = $(this).data('lock-id');
- if (typeof lockId === 'undefined') {
- return;
- }
- /*
- * @todo Fix Code mirror does not give correct full value (query)
- * in textarea, it returns only the change in content.
- */
+ lockPageHandler: function (event) {
var newHash = null;
- if (event.data.value == 1) {
- newHash = AJAX.hash($(this).val());
+ var oldHash = null;
+ var lockId;
+ // CodeMirror lock
+ if (event.data.value === 3) {
+ newHash = event.data.content;
+ oldHash = true;
+ lockId = 'cm';
} else {
- newHash = AJAX.hash($(this).is(":checked"));
+ // Don't lock on enter.
+ if (0 === event.charCode) {
+ return;
+ }
+
+ lockId = $(this).data('lock-id');
+ if (typeof lockId === 'undefined') {
+ return;
+ }
+ /*
+ * @todo Fix Code mirror does not give correct full value (query)
+ * in textarea, it returns only the change in content.
+ */
+ if (event.data.value === 1) {
+ newHash = AJAX.hash($(this).val());
+ } else {
+ newHash = AJAX.hash($(this).is(':checked'));
+ }
+ oldHash = $(this).data('val-hash');
}
- var oldHash = $(this).data('val-hash');
- // Set lock if old value != new value
+ // Set lock if old value !== new value
// otherwise release lock
if (oldHash !== newHash) {
AJAX.lockedTargets[lockId] = true;