refactor: Move replace_emoji_with_text from ui to ui_util.

This commit is contained in:
Lalit
2023-04-25 10:08:51 +05:30
committed by Tim Abbott
parent e132a68193
commit b55ee161e2
3 changed files with 10 additions and 11 deletions

View File

@@ -21,6 +21,15 @@ 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();
});
}
export function blur_active_element(): void {
// this blurs anything that may perhaps be actively focused on.
if (document.activeElement instanceof HTMLElement) {