mirror of https://github.com/zulip/zulip.git
click handler: Consolidate composebox-closing logic.
Previously, we stopped the composebox from closing on in-composebox clicks by stopping propagation from the composebox click handler. This was an issue because we need to propagate the event to bootstrap in situations like dropdown clicks. We can avoid closing the composebox on in-composebox clicks by just checking if the click is in the composebox.
This commit is contained in:
parent
32f75085cb
commit
429f23fc4f
|
@ -679,14 +679,6 @@ export function initialize() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't let clicks in the compose area count as
|
|
||||||
// "unfocusing" our compose -- in other words, e.g.
|
|
||||||
// clicking "Press Enter to send" should not
|
|
||||||
// trigger the composebox-closing code in MAIN CLICK HANDLER.
|
|
||||||
// But do allow our formatting link.
|
|
||||||
if (!$target.is("a")) {
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
// Still hide the popovers, however
|
// Still hide the popovers, however
|
||||||
popovers.hide_all();
|
popovers.hide_all();
|
||||||
}
|
}
|
||||||
|
@ -876,6 +868,7 @@ export function initialize() {
|
||||||
$("#compose-textarea").trigger("focus");
|
$("#compose-textarea").trigger("focus");
|
||||||
return;
|
return;
|
||||||
} else if (
|
} else if (
|
||||||
|
!$(e.target).parents("#compose").length &&
|
||||||
!window.getSelection().toString() &&
|
!window.getSelection().toString() &&
|
||||||
// Clicking any input or text area should not close
|
// Clicking any input or text area should not close
|
||||||
// the compose box; this means using the sidebar
|
// the compose box; this means using the sidebar
|
||||||
|
|
Loading…
Reference in New Issue