compose_ui: Fix implicit use of any.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-05-06 15:41:09 -07:00
committed by Tim Abbott
parent acf13e49cf
commit 3fc5800d53
3 changed files with 10 additions and 10 deletions

View File

@@ -333,13 +333,13 @@ export function initialize() {
compose_call_ui.generate_and_insert_audio_or_video_call_link($(e.target), true);
});
$("body").on("click", ".time_pick", (e) => {
$("body").on("click", ".time_pick", function (e) {
e.preventDefault();
e.stopPropagation();
let $target_textarea;
let edit_message_id;
const compose_click_target = compose_ui.get_compose_click_target(e);
const compose_click_target = compose_ui.get_compose_click_target(this);
if ($(compose_click_target).parents(".message_edit_form").length === 1) {
edit_message_id = rows.id($(compose_click_target).parents(".message_row"));
$target_textarea = $(`#edit_form_${CSS.escape(edit_message_id)} .message_edit_content`);
@@ -472,10 +472,10 @@ export function initialize() {
compose_recipient.update_placeholder_text();
});
$("body").on("click", ".formatting_button", (e) => {
const $compose_click_target = $(compose_ui.get_compose_click_target(e));
$("body").on("click", ".formatting_button", function (e) {
const $compose_click_target = $(compose_ui.get_compose_click_target(this));
const $textarea = $compose_click_target.closest("form").find("textarea");
const format_type = $(e.target).attr("data-format-type");
const format_type = $(this).attr("data-format-type");
compose_ui.format_text($textarea, format_type);
popovers.hide_all();
$textarea.trigger("focus");

View File

@@ -1119,13 +1119,13 @@ export function show_compose_spinner(): void {
$(".compose-submit-button").addClass("disable-btn");
}
export function get_compose_click_target(e: JQuery.ClickEvent): Element {
export function get_compose_click_target(element: HTMLElement): Element {
const compose_control_buttons_popover = popover_menus.get_compose_control_buttons_popover();
if (
compose_control_buttons_popover &&
$(compose_control_buttons_popover.popper).has(e.target).length
$(compose_control_buttons_popover.popper).has(element).length
) {
return compose_control_buttons_popover.reference;
}
return e.target;
return element;
}

View File

@@ -761,11 +761,11 @@ function register_click_handlers() {
handle_emoji_clicked($(e.currentTarget), e);
});
$("body").on("click", ".emoji_map", (e) => {
$("body").on("click", ".emoji_map", function (e) {
e.preventDefault();
e.stopPropagation();
const compose_click_target = compose_ui.get_compose_click_target(e);
const compose_click_target = compose_ui.get_compose_click_target(this);
if ($(compose_click_target).parents(".message_edit_form").length === 1) {
// Store message id in global variable edit_message_id so that
// its value can be further used to correctly find the message textarea element.