compose: Use rendered_markdown.update_elements for previews.

As we add more features where rendered_markdown.update_elements does
something useful, it'll become important to run this code everywhere
we render markdown in the DOM.

One can see in this case that we had actually copied one hunk of
rendered_markdown.update_elements years ago, before we extracted it as
an independent function; we get to delete that copy.

Fixes #15500.
This commit is contained in:
Tim Abbott
2020-06-20 23:55:58 -07:00
committed by Tim Abbott
parent 4f6cd6577c
commit 8672805ddf
2 changed files with 8 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
const rendered_markdown = require("./rendered_markdown");
const util = require("./util");
const render_compose_all_everyone = require("../templates/compose_all_everyone.hbs");
const render_compose_announce = require("../templates/compose_announce.hbs");
@@ -799,12 +800,7 @@ exports.render_and_show_preview = function (preview_spinner, preview_content_box
}
preview_content_box.html(util.clean_user_content_links(rendered_preview_html));
if (page_params.emojiset === "text") {
preview_content_box.find(".emoji").replaceWith(function () {
const text = $(this).attr("title");
return ":" + text + ":";
});
}
rendered_markdown.update_elements(preview_content_box);
}
if (content.length === 0) {