Implement cancel replyto on escape key press (#777)
This commit is contained in:
parent
fd79ea4b9b
commit
33949dbdb1
1 changed files with 6 additions and 0 deletions
|
@ -263,6 +263,11 @@ function RoomViewInput({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleKeyDown = (e) => {
|
const handleKeyDown = (e) => {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
e.preventDefault();
|
||||||
|
roomsInput.cancelReplyTo(roomId);
|
||||||
|
setReplyTo(null);
|
||||||
|
}
|
||||||
if (e.key === 'Enter' && e.shiftKey === false) {
|
if (e.key === 'Enter' && e.shiftKey === false) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
sendMessage();
|
sendMessage();
|
||||||
|
@ -421,6 +426,7 @@ function RoomViewInput({
|
||||||
/>
|
/>
|
||||||
<MessageReply
|
<MessageReply
|
||||||
userId={replyTo.userId}
|
userId={replyTo.userId}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
name={getUsername(replyTo.userId)}
|
name={getUsername(replyTo.userId)}
|
||||||
color={colorMXID(replyTo.userId)}
|
color={colorMXID(replyTo.userId)}
|
||||||
body={replyTo.body}
|
body={replyTo.body}
|
||||||
|
|
Loading…
Reference in a new issue