compose: Fix compose box getting close on copying code.

This commit adds an exception in click-handlers.js so that
when mouse clicks on .copy-codeblock, the composebox is not
closed.

Fixes #19130.
This commit is contained in:
Priyam Seth 2021-07-07 21:44:31 +05:30 committed by Tim Abbott
parent d6711e3cd2
commit e976512b3c
1 changed files with 10 additions and 3 deletions

View File

@ -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 (