mirror of https://github.com/zulip/zulip.git
compose: Fix confusing variable name in preview code path.
This seems to be the root cause of the bug fixed in the last commit.
This commit is contained in:
parent
eb6d736df3
commit
0f1768d0d1
|
@ -651,16 +651,16 @@ exports.initialize = function () {
|
||||||
|
|
||||||
$("#compose").on("click", "#markdown_preview", function (e) {
|
$("#compose").on("click", "#markdown_preview", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var message = $("#new_message_content").val();
|
var content = $("#new_message_content").val();
|
||||||
$("#new_message_content").hide();
|
$("#new_message_content").hide();
|
||||||
$("#markdown_preview").hide();
|
$("#markdown_preview").hide();
|
||||||
$("#undo_markdown_preview").show();
|
$("#undo_markdown_preview").show();
|
||||||
$("#preview_message_area").show();
|
$("#preview_message_area").show();
|
||||||
|
|
||||||
if (message.length === 0) {
|
if (content.length === 0) {
|
||||||
$("#preview_content").html(i18n.t("Nothing to preview"));
|
$("#preview_content").html(i18n.t("Nothing to preview"));
|
||||||
} else {
|
} else {
|
||||||
if (markdown.contains_backend_only_syntax(message)) {
|
if (markdown.contains_backend_only_syntax(content)) {
|
||||||
var spinner = $("#markdown_preview_spinner").expectOne();
|
var spinner = $("#markdown_preview_spinner").expectOne();
|
||||||
loading.make_indicator(spinner);
|
loading.make_indicator(spinner);
|
||||||
} else {
|
} else {
|
||||||
|
@ -672,22 +672,22 @@ exports.initialize = function () {
|
||||||
// accurate; if the `markdown.contains_backend_only_syntax` logic is
|
// accurate; if the `markdown.contains_backend_only_syntax` logic is
|
||||||
// incorrect wrong, users will see a brief flicker).
|
// incorrect wrong, users will see a brief flicker).
|
||||||
var message_obj = {
|
var message_obj = {
|
||||||
raw_content: message,
|
raw_content: content,
|
||||||
};
|
};
|
||||||
$("#preview_content").html(markdown.apply_markdown(message_obj));
|
$("#preview_content").html(markdown.apply_markdown(message_obj));
|
||||||
}
|
}
|
||||||
channel.post({
|
channel.post({
|
||||||
url: '/json/messages/render',
|
url: '/json/messages/render',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
data: {content: message},
|
data: {content: content},
|
||||||
success: function (response_data) {
|
success: function (response_data) {
|
||||||
if (markdown.contains_backend_only_syntax(message)) {
|
if (markdown.contains_backend_only_syntax(content)) {
|
||||||
loading.destroy_indicator($("#markdown_preview_spinner"));
|
loading.destroy_indicator($("#markdown_preview_spinner"));
|
||||||
}
|
}
|
||||||
$("#preview_content").html(response_data.rendered);
|
$("#preview_content").html(response_data.rendered);
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
if (markdown.contains_backend_only_syntax(message)) {
|
if (markdown.contains_backend_only_syntax(content)) {
|
||||||
loading.destroy_indicator($("#markdown_preview_spinner"));
|
loading.destroy_indicator($("#markdown_preview_spinner"));
|
||||||
}
|
}
|
||||||
$("#preview_content").html(i18n.t("Failed to generate preview"));
|
$("#preview_content").html(i18n.t("Failed to generate preview"));
|
||||||
|
|
Loading…
Reference in New Issue