popovers: Convert module to TypeScript.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-10 16:14:01 -07:00 committed by Tim Abbott
parent 0006f4a90c
commit 2163cb7770
3 changed files with 5 additions and 5 deletions

View File

@ -162,7 +162,7 @@ EXEMPT_FILES = make_set(
"web/src/poll_widget.js",
"web/src/popover_menus.js",
"web/src/popover_menus_data.js",
"web/src/popovers.js",
"web/src/popovers.ts",
"web/src/read_receipts.js",
"web/src/ready.ts",
"web/src/realm_icon.ts",

View File

@ -106,7 +106,7 @@ export function toggle_collapse(message) {
if (message.is_me_message) {
// Disabled temporarily because /me messages don't have a
// styling for collapsing /me messages (they only recently
// added multi-line support). See also popovers.js.
// added multi-line support). See also popover_menus_data.js.
return;
}

View File

@ -1,9 +1,9 @@
import $ from "jquery";
import * as tippy from "tippy.js";
export function any_active() {
export function any_active(): boolean {
// Checks if there are any interactive tippy instances (= popovers) present.
const $tippy_instances = $("[data-tippy-root]");
const $tippy_instances = $<tippy.PopperElement>("div[data-tippy-root]");
// Tippy instances with `interactive: true` are popovers by definition.
const num_interactive_instances = $tippy_instances.filter(
(_i, elt) => elt._tippy?.props.interactive === true,
@ -11,7 +11,7 @@ export function any_active() {
return Boolean(num_interactive_instances);
}
export function hide_all() {
export function hide_all(): void {
// Hides all tippy instances (tooltips and popovers).
tippy.hideAll();
}