Implement cancel replyto on escape key press (#777)

This commit is contained in:
jameskitt616 2022-08-27 04:51:41 +02:00 committed by GitHub
parent fd79ea4b9b
commit 33949dbdb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -263,6 +263,11 @@ function RoomViewInput({
};
const handleKeyDown = (e) => {
if (e.key === 'Escape') {
e.preventDefault();
roomsInput.cancelReplyTo(roomId);
setReplyTo(null);
}
if (e.key === 'Enter' && e.shiftKey === false) {
e.preventDefault();
sendMessage();
@ -421,6 +426,7 @@ function RoomViewInput({
/>
<MessageReply
userId={replyTo.userId}
onKeyDown={handleKeyDown}
name={getUsername(replyTo.userId)}
color={colorMXID(replyTo.userId)}
body={replyTo.body}