markdown: Add `zulip-code-block` class to code blocks.

We add this class to code blocks so that we can easily detect them in
`copy_and_paste.js` in the next commit.
This commit is contained in:
N-Shar-ma 2023-10-25 18:58:25 +05:30 committed by Tim Abbott
parent 3eb569f7b1
commit 7c10775e96
1 changed files with 3 additions and 1 deletions

View File

@ -236,7 +236,8 @@ export const update_elements = ($content) => {
$(this).prepend(toggle_button_html);
});
// Display the view-code-in-playground and the copy-to-clipboard button inside the div.codehilite element.
// Display the view-code-in-playground and the copy-to-clipboard button inside the div.codehilite element,
// and add a `zulip-code-block` class to it to detect it easily in `copy_and_paste.js`.
$content.find("div.codehilite").each(function () {
const $codehilite = $(this);
const $pre = $codehilite.find("pre");
@ -274,6 +275,7 @@ export const update_elements = ($content) => {
clipboard.on("success", () => {
show_copied_confirmation($copy_button[0]);
});
$codehilite.addClass("zulip-code-block");
});
// Display emoji (including realm emoji) as text if