mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
compose: Fix behavior hitting enter with the preview area open.
The new behavior is: (1) If enter-sends is enabled, just send the messsage. (2) If enter-sends is not enabled, return focus to the compose area. Based on great work by khantaalaman in #3673. Fixes #3489.
This commit is contained in:
@@ -607,6 +607,17 @@ function send_message(request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.enter_with_preview_open = function () {
|
||||||
|
clear_preview_area();
|
||||||
|
if (page_params.enter_sends) {
|
||||||
|
// If enter_sends is enabled, we just send the message
|
||||||
|
send_message();
|
||||||
|
} else {
|
||||||
|
// Otherwise, we return to the compose box and focus it
|
||||||
|
$("#new_message_content").focus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.respond_to_message = function (opts) {
|
exports.respond_to_message = function (opts) {
|
||||||
var message;
|
var message;
|
||||||
var msg_type;
|
var msg_type;
|
||||||
|
|||||||
@@ -331,6 +331,12 @@ function process_hotkey(e) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There's special handling for when you're previewing a composition
|
||||||
|
if ($("#preview_message_area").is(":visible")) {
|
||||||
|
compose.enter_with_preview_open();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Shortcuts that don't require a message
|
// Shortcuts that don't require a message
|
||||||
switch (event_name) {
|
switch (event_name) {
|
||||||
case 'narrow_private':
|
case 'narrow_private':
|
||||||
|
|||||||
Reference in New Issue
Block a user