diff --git a/static/js/compose.js b/static/js/compose.js index af55ea8cc2..10e46ac608 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -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) { var message; var msg_type; diff --git a/static/js/hotkey.js b/static/js/hotkey.js index e19459a242..14f962ea70 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -331,6 +331,12 @@ function process_hotkey(e) { 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 switch (event_name) { case 'narrow_private':