From 2163cb77701e0d2c49e59ef714178710e303bbc2 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 10 Oct 2023 16:14:01 -0700 Subject: [PATCH] popovers: Convert module to TypeScript. Signed-off-by: Anders Kaseorg --- tools/test-js-with-node | 2 +- web/src/condense.js | 2 +- web/src/{popovers.js => popovers.ts} | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) rename web/src/{popovers.js => popovers.ts} (76%) diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 4aee6b6639..c5cef1c248 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -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", diff --git a/web/src/condense.js b/web/src/condense.js index 452638f4a6..06fc7791e6 100644 --- a/web/src/condense.js +++ b/web/src/condense.js @@ -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; } diff --git a/web/src/popovers.js b/web/src/popovers.ts similarity index 76% rename from web/src/popovers.js rename to web/src/popovers.ts index 8688bd395c..3f63997590 100644 --- a/web/src/popovers.js +++ b/web/src/popovers.ts @@ -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 = $("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(); }