Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

overlays: Call open and close hooks for modals too.

Aman Agrawal4e4daf2ce55a
diff --git a/web/src/overlays.ts b/web/src/overlays.ts
index 8b5a1ddea5d..d26206b5946 100644
--- a/web/src/overlays.ts
+++ b/web/src/overlays.ts
@@ -27,6 +27,9 @@ export type ModalConfig = {
let active_overlay: Overlay | undefined;
let open_overlay_name: string | undefined;
+// Used for both overlays and modals.
+// We could split these hooks so that they are separate for
+// overlays and modals if we need to.
const pre_open_hooks: Hook[] = [];
const pre_close_hooks: Hook[] = [];
@@ -261,6 +264,7 @@ export function open_modal(
conf.on_show();
}
disable_scrolling();
+ call_hooks(pre_open_hooks);
}
function on_close_callback(): void {
@@ -268,6 +272,7 @@ export function open_modal(
conf.on_hide();
}
enable_scrolling();
+ call_hooks(pre_close_hooks);
}
Micromodal.show(modal_id, {