From ec5caa57cc14a328b8b994d49cb8def8eb95aea7 Mon Sep 17 00:00:00 2001 From: Koosha KM Date: Thu, 28 Aug 2014 17:17:54 +0000 Subject: Bug 330707: Add optional support for MarkDown r=dkl,a=sgreen --- js/field.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/field.js b/js/field.js index 7c5c5b64e..20b08da48 100644 --- a/js/field.js +++ b/js/field.js @@ -979,11 +979,13 @@ function initDirtyFieldTracking() { */ var last_comment_text = ''; +var last_markdown_cb_value = null; function show_comment_preview(bug_id) { var Dom = YAHOO.util.Dom; var comment = document.getElementById('comment'); var preview = document.getElementById('comment_preview'); + var markdown_cb = document.getElementById('use_markdown'); if (!comment || !preview) return; if (Dom.hasClass('comment_preview_tab', 'active_comment_tab')) return; @@ -1003,7 +1005,7 @@ function show_comment_preview(bug_id) { Dom.addClass('comment_preview_error', 'bz_default_hidden'); - if (last_comment_text == comment.value) + if (last_comment_text == comment.value && last_markdown_cb_value == markdown_cb.checked) return; Dom.addClass('comment_preview_text', 'bz_default_hidden'); @@ -1024,6 +1026,7 @@ function show_comment_preview(bug_id) { Dom.addClass('comment_preview_loading', 'bz_default_hidden'); Dom.removeClass('comment_preview_text', 'bz_default_hidden'); last_comment_text = comment.value; + last_markdown_cb_value = markdown_cb.checked; } }, failure: function(res) { @@ -1039,7 +1042,8 @@ function show_comment_preview(bug_id) { params: { Bugzilla_api_token: BUGZILLA.api_token, id: bug_id, - text: comment.value + text: comment.value, + markdown: (markdown_cb != null) && markdown_cb.checked ? 1 : 0 } }) ); -- cgit v1.2.3-24-g4f1b