From ee70ebd10a55d4045ad7b9b2d62827112adcbbcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 22 May 2013 15:51:36 +0200 Subject: [PATCH] Fixed highlight interactions with inline editor --- js/functions.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/functions.js b/js/functions.js index efde26fc5d..c3a9c1ea87 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1352,6 +1352,7 @@ AJAX.registerOnload('functions.js', function () { var $form = $(this).prev('form'); var sql_query = $form.find("input[name='sql_query']").val(); var $inner_sql = $(this).parent().prev().find('.inner_sql'); + var $sql_highlight = $(this).parent().prev().find('.sql-highlight'); var old_text = $inner_sql.html(); var new_content = "\n"; @@ -1364,6 +1365,7 @@ AJAX.registerOnload('functions.js', function () { } $editor_area.html(new_content); $inner_sql.hide(); + $sql_highlight.hide(); bindCodeMirrorToInlineEditor(); return false; @@ -1387,8 +1389,8 @@ AJAX.registerOnload('functions.js', function () { $("input#sql_query_edit_discard").live('click', function () { $('div#inline_editor_outer') - .empty() - .siblings('.inner_sql').show(); + .siblings('.sql-highlight').show(); + $('div#inline_editor_outer').remove(); }); $('input.sqlbutton').click(function (evt) { @@ -1496,7 +1498,7 @@ function PMA_highlightSQL(base) var $sql = $(this); /* We only care about visible elements to avoid double processing */ if ($sql.is(":visible")) { - var $highlight = $('
'); + var $highlight = $('
'); $sql.append($highlight); console.log('Highlight SQL: ' + $sql.text()); CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]);