Have Esc dismiss userinfo popover.

It's possible that the three places we can kill a popover
(body click, Esc, clicking on a new one) should be
refactored to use the same code.

(imported from commit ba7eab480fd2258abfb469c8f1155f29bc63f7f6)
This commit is contained in:
Waseem Daher 2012-10-29 15:48:22 -04:00
parent 0e03a7acc8
commit 3c3877f1b5
3 changed files with 7 additions and 2 deletions

View File

@ -36,6 +36,7 @@ var globals =
+ ' register_onclick hide_email show_email'
+ ' report_error report_success report_message clicking mouse_moved'
+ ' update_autocomplete autocomplete_needs_update'
+ ' userinfo_currently_popped'
// zephyr.js
+ ' message_array message_dict get_updates_params'

View File

@ -91,8 +91,11 @@ function process_hotkey(code) {
select_message(rows.last_visible(), {then_scroll: false});
}
return false;
case 27: // Esc: cancel compose or un-narrow
if (compose.composing()) {
case 27: // Esc: close userinfo popup, cancel compose, or un-narrow
if (userinfo_currently_popped !== undefined) {
userinfo_currently_popped.popover("destroy");
userinfo_currently_popped = undefined;
} else if (compose.composing()) {
compose.cancel();
} else {
narrow.show_all_messages();

View File

@ -256,6 +256,7 @@ function userinfo_popover(event, element, id) {
// One popover at a time.
if (userinfo_currently_popped) {
userinfo_currently_popped.popover("destroy");
userinfo_currently_popped = undefined;
}
var message = message_dict[id];
elt.popover({placement: "bottom",