From 63596c20d454b108b3f6085930e4ab89706cec7f Mon Sep 17 00:00:00 2001 From: akira0245 <33274390+akira0245@users.noreply.github.com> Date: Thu, 30 Mar 2023 16:06:51 +0800 Subject: [PATCH] feat: add shortcut for "save and submit" when editing message (#127) save and submit the edited message when ctrl and shift key been pressed simultaneously. Co-authored-by: Jing Hua <59118459+ztjhz@users.noreply.github.com> --- .../Chat/ChatContent/Message/MessageContent.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Chat/ChatContent/Message/MessageContent.tsx b/src/components/Chat/ChatContent/Message/MessageContent.tsx index 1901fdf..28755bc 100644 --- a/src/components/Chat/ChatContent/Message/MessageContent.tsx +++ b/src/components/Chat/ChatContent/Message/MessageContent.tsx @@ -353,8 +353,12 @@ const EditView = ({ handleSaveAndSubmit(); resetTextAreaHeight(); } - } else if (e.ctrlKey || e.shiftKey) { - handleSave(); + } else { + if (e.ctrlKey && e.shiftKey) { + e.preventDefault(); + handleSaveAndSubmit(); + resetTextAreaHeight(); + } else if (e.ctrlKey || e.shiftKey) handleSave(); } } };