mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
ui_util: Fix HTML injection bug in replace_emoji_with_text.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
4dc27216f4
commit
191345f9d6
@@ -23,12 +23,16 @@ export function place_caret_at_end(el: HTMLElement): void {
|
||||
}
|
||||
|
||||
export function replace_emoji_with_text($element: JQuery): void {
|
||||
$element.find(".emoji").replaceWith(function () {
|
||||
if ($(this).is("img")) {
|
||||
return $(this).attr("alt") ?? "";
|
||||
}
|
||||
return $(this).text();
|
||||
});
|
||||
$element
|
||||
.find(".emoji")
|
||||
.text(function () {
|
||||
if ($(this).is("img")) {
|
||||
return $(this).attr("alt") ?? "";
|
||||
}
|
||||
return $(this).text();
|
||||
})
|
||||
.contents()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
export function change_katex_to_raw_latex($element: JQuery): void {
|
||||
|
||||
Reference in New Issue
Block a user