From c293e268e83cceccdb1316caf12a0ea8a7f17d50 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 11 Jun 2021 14:34:50 +1000 Subject: [PATCH] Do not send message if a modifier is pressed to enable multiline msgs --- CHANGELOG.md | 1 + examples/web-chat/src/MessageInput.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e316f039b..adf23ef2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Test: Upgrade nim-waku node to v0.4. - Waku Light Push upgraded to `2.0.0-beta1`. - Examples (web chat): Catch error if chat message decoding fails. +- Examples (web chat): Do not send message if shift/alt/ctrl is pressed, enabling multiline messages. ## [0.6.0] - 2021-06-09 diff --git a/examples/web-chat/src/MessageInput.tsx b/examples/web-chat/src/MessageInput.tsx index 3911bb873b..9322779d14 100644 --- a/examples/web-chat/src/MessageInput.tsx +++ b/examples/web-chat/src/MessageInput.tsx @@ -29,7 +29,12 @@ export default function MessageInput(props: Props) { }; const keyPressHandler = async (event: KeyboardEvent) => { - if (event.key === 'Enter') { + if ( + event.key === 'Enter' && + !event.altKey && + !event.ctrlKey && + !event.shiftKey + ) { await sendMessage(); } };