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.

tippy: Add callback, timeout args to copied confirmation.

Karl Stolleyb75b53d46543
diff --git a/web/src/tippyjs.js b/web/src/tippyjs.js
index 3bc09e76503..aa83a1ad236 100644
--- a/web/src/tippyjs.js
+++ b/web/src/tippyjs.js
@@ -401,7 +401,7 @@ export function initialize() {
});
}
-export function show_copied_confirmation($copy_button) {
+export function show_copied_confirmation($copy_button, on_hide_callback, timeout_in_ms = 1000) {
// Display a tooltip to notify the user the message or code was copied.
const instance = tippy($copy_button, {
placement: "top",
@@ -409,6 +409,11 @@ export function show_copied_confirmation($copy_button) {
onUntrigger() {
remove_instance();
},
+ onHide() {
+ if (on_hide_callback) {
+ on_hide_callback();
+ }
+ },
});
instance.setContent($t({defaultMessage: "Copied!"}));
instance.show();
@@ -417,5 +422,5 @@ export function show_copied_confirmation($copy_button) {
instance.destroy();
}
}
- setTimeout(remove_instance, 1000);
+ setTimeout(remove_instance, timeout_in_ms);
}