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.

compose: Fix compose box getting close on copying code.

Priyam Sethe976512b3cac
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index 121889000ce..ba7409432f6 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -828,10 +828,17 @@ export function initialize() {
}
if (compose_state.composing()) {
- if ($(e.target).closest("a").length > 0) {
+ if (
+ $(e.target).closest("a").length > 0 ||
+ $(e.target).closest(".copy_codeblock").length > 0
+ ) {
// Refocus compose message text box if one clicks an external
- // link/url to view something else while composing a message
- // See issue #4331 for more details
+ // link/url to view something else while composing a message.
+ // See issue #4331 for more details.
+ //
+ // We do the same when copying a code block, since the
+ // most likely next action within Zulip is to paste it
+ // into compose and modify it.
$("#compose-textarea").trigger("focus");
return;
} else if (