From 1deef51df0c92d4c8394cb6d4c76aaf2ea473f32 Mon Sep 17 00:00:00 2001 From: jameskitt616 <52933658+jameskitt616@users.noreply.github.com> Date: Sat, 20 Aug 2022 15:26:37 +0200 Subject: [PATCH] Add cancel edit-message on Escape Key press (#765) --- src/app/molecules/message/Message.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/molecules/message/Message.jsx b/src/app/molecules/message/Message.jsx index 1e5a006..42344d7 100644 --- a/src/app/molecules/message/Message.jsx +++ b/src/app/molecules/message/Message.jsx @@ -290,6 +290,11 @@ function MessageEdit({ body, onSave, onCancel }) { }, []); const handleKeyDown = (e) => { + if (e.key === 'Escape') { + e.preventDefault(); + onCancel(); + } + if (e.key === 'Enter' && e.shiftKey === false) { e.preventDefault(); onSave(editInputRef.current.value);