Do not send message if a modifier is pressed to enable multiline msgs

This commit is contained in:
Franck Royer 2021-06-11 14:34:50 +10:00
parent 8073021d82
commit c293e268e8
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -29,7 +29,12 @@ export default function MessageInput(props: Props) {
};
const keyPressHandler = async (event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') {
if (
event.key === 'Enter' &&
!event.altKey &&
!event.ctrlKey &&
!event.shiftKey
) {
await sendMessage();
}
};