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.

drafts: Create ClipboardJS instance once at initialize.

Aadyot1d2f48ffafdce
diff --git a/web/src/drafts_overlay_ui.ts b/web/src/drafts_overlay_ui.ts
index 42b0f82da2f..f611d8e62d0 100644
--- a/web/src/drafts_overlay_ui.ts
+++ b/web/src/drafts_overlay_ui.ts
@@ -405,21 +405,6 @@ function setup_event_handlers(): void {
toggle_checkbox_icon_state($(e.target), !is_checked);
update_bulk_delete_ui();
});
-
- new ClipboardJS("#drafts_table .overlay_message_controls .copy-overlay-message", {
- text(trigger): string {
- const draft_id = $(trigger).attr("data-draft-id")!;
- const draft = drafts.draft_model.getDraft(draft_id);
- if (!draft) {
- return "";
- }
- return draft.content ?? "";
- },
- }).on("success", (e) => {
- show_copied_confirmation(e.trigger, {
- show_check_icon: true,
- });
- });
}
function setup_bulk_actions_handlers(): void {
@@ -534,6 +519,21 @@ export function toggle_checkbox_icon_state($checkbox: JQuery, checked: boolean):
}
export function initialize(): void {
+ new ClipboardJS("#drafts_table .overlay_message_controls .copy-overlay-message", {
+ text(trigger): string {
+ const draft_id = $(trigger).attr("data-draft-id")!;
+ const draft = drafts.draft_model.getDraft(draft_id);
+ if (!draft) {
+ return "";
+ }
+ return draft.content ?? "";
+ },
+ }).on("success", (e) => {
+ show_copied_confirmation(e.trigger, {
+ show_check_icon: true,
+ });
+ });
+
$("body").on("focus", "#drafts_table .overlay-message-info-box", function (this: HTMLElement) {
messages_overlay_ui.activate_element(this, keyboard_handling_context);
});