From 49d60500f63bc75e635100a8363b197b8ae296eb Mon Sep 17 00:00:00 2001 From: Bojan Mojsilovic Date: Mon, 11 Sep 2023 15:07:51 +0200 Subject: [PATCH] Select highlighted emoji on semicolon --- src/components/NewNote/EditBox/EditBox.tsx | 8 ++++++-- src/pages/Messages.tsx | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/NewNote/EditBox/EditBox.tsx b/src/components/NewNote/EditBox/EditBox.tsx index 113bb15..7d5e720 100644 --- a/src/components/NewNote/EditBox/EditBox.tsx +++ b/src/components/NewNote/EditBox/EditBox.tsx @@ -241,7 +241,7 @@ const EditBox: Component<{ return false; } - if (mentionSeparators.includes(e.code)) { + if (mentionSeparators.includes(e.code) || e.code === 'Semicolon') { if (emojiQuery().trim().length === 0) { setEmojiInput(false); return false; @@ -263,7 +263,11 @@ const EditBox: Component<{ setEmojiInput(false); return false; } - } else if (!['Shift', 'Control', 'Meta'].includes(e.key)) { + + return false; + } + + if (!['Shift', 'Control', 'Meta'].includes(e.key)) { setEmojiQuery(q => q + e.key); return false; } diff --git a/src/pages/Messages.tsx b/src/pages/Messages.tsx index 0c44b53..8d3a339 100644 --- a/src/pages/Messages.tsx +++ b/src/pages/Messages.tsx @@ -464,7 +464,10 @@ const Messages: Component = () => { return false; } - if (mentionSeparators.includes(e.code)) { + if (e.code === 'Semicolon') { + } + + if (mentionSeparators.includes(e.code) || e.code === 'Semicolon') { if (emojiQuery().trim().length === 0) { setEmojiInput(false); return false; @@ -486,7 +489,11 @@ const Messages: Component = () => { setEmojiInput(false); return false; } - } else if (!['Shift', 'Control', 'Meta'].includes(e.key)) { + + return false; + } + + if (!['Shift', 'Control', 'Meta'].includes(e.key)) { setEmojiQuery(q => q + e.key); return false; }