diff --git a/web/src/api/types/preferences/preferences.ts b/web/src/api/types/preferences/preferences.ts index 2e4c033..393cf68 100644 --- a/web/src/api/types/preferences/preferences.ts +++ b/web/src/api/types/preferences/preferences.ts @@ -141,6 +141,12 @@ export const preferences = { allowedContexts: anyContext, defaultValue: true, }), + ctrl_enter_send: new Preference({ + displayName: "Use Ctrl+Enter to send", + description: "Disable sending on enter and use Ctrl+Enter for sending instead", + allowedContexts: anyContext, + defaultValue: false, + }), custom_notification_sound: new Preference({ displayName: "Custom notification sound", description: "The mxc:// URI to a custom notification sound.", diff --git a/web/src/ui/composer/MessageComposer.tsx b/web/src/ui/composer/MessageComposer.tsx index 5dc5a43..1f79dfa 100644 --- a/web/src/ui/composer/MessageComposer.tsx +++ b/web/src/ui/composer/MessageComposer.tsx @@ -274,7 +274,10 @@ const MessageComposer = () => { const onComposerKeyDown = useEvent((evt: React.KeyboardEvent) => { const inp = evt.currentTarget const fullKey = keyToString(evt) - if (fullKey === "Enter" && ( + const sendKey = fullKey === "Enter" || fullKey === "Ctrl+Enter" + ? (room.preferences.ctrl_enter_send ? "Ctrl+Enter" : "Enter") + : null + if (fullKey === sendKey && ( // If the autocomplete already has a selected item or has no results, send message even if it's open. // Otherwise, don't send message on enter, select the first autocomplete entry instead. !autocomplete