Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Allow ctrl + enter to send in preview mode as well.
N-Shar-ma87a6c3924be7
diff --git a/static/js/compose.js b/static/js/compose.jsindex cbe7084ba9e..5c1c10bfa47 100644--- a/static/js/compose.js+++ b/static/js/compose.js@@ -268,9 +268,12 @@ export function send_message(request = create_message_object()) {}}-export function enter_with_preview_open() {- if (user_settings.enter_sends) {- // If enter_sends is enabled, we attempt to send the message+export function enter_with_preview_open(ctrl_pressed = false) {+ if (+ (user_settings.enter_sends && !ctrl_pressed) ||+ (!user_settings.enter_sends && ctrl_pressed)+ ) {+ // If this enter should send, we attempt to send the message.finish();} else {// Otherwise, we return to the normal compose state.diff --git a/static/js/hotkey.js b/static/js/hotkey.jsindex 7a8f7a6030e..179354cc0e2 100644--- a/static/js/hotkey.js+++ b/static/js/hotkey.js@@ -89,6 +89,7 @@ const keydown_unshift_mappings = {const keydown_ctrl_mappings = {219: {name: "escape", message_view_only: false}, // '['+ 13: {name: "ctrl_enter", message_view_only: true}, // enter};const keydown_cmd_or_ctrl_mappings = {@@ -471,6 +472,16 @@ export function process_enter_key(e) {return true;}+export function process_ctrl_enter_key() {+ if ($("#preview_message_area").is(":visible")) {+ const ctrl_pressed = true;+ compose.enter_with_preview_open(ctrl_pressed);+ return true;+ }++ return false;+}+export function process_tab_key() {// Returns true if we handled it, false if the browser should.// TODO: See if browsers like Safari can now handle tabbing correctly@@ -566,6 +577,8 @@ export function process_hotkey(e, hotkey) {return process_escape_key(e);case "enter":return process_enter_key(e);+ case "ctrl_enter":+ return process_ctrl_enter_key(e);case "tab":return process_tab_key();case "shift_tab":