From bbbb0c474b22c254167c71df346a0f441f929215 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Thu, 1 Feb 2024 02:14:46 +0530 Subject: [PATCH] fixed issue of emoji not inserted between written texts --- index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 3db1265..3258458 100644 --- a/index.html +++ b/index.html @@ -3622,7 +3622,13 @@ getRef('emoji_picker').addEventListener('emoji-click', e => { const clickedEmoji = e.detail.unicode - getRef('type_message').value += clickedEmoji + // append emoji to input field where cursor was + const cursorPosition = getRef('type_message').textarea.selectionStart; + const textBeforeCursor = getRef('type_message').value.substring(0, cursorPosition) + const textAfterCursor = getRef('type_message').value.substring(cursorPosition) + getRef('type_message').value = textBeforeCursor + clickedEmoji + textAfterCursor + getRef('type_message').textarea.selectionStart = cursorPosition + clickedEmoji.length + getRef('type_message').textarea.selectionEnd = cursorPosition + clickedEmoji.length if (!floGlobals.isMobileView) { setTimeout(() => { getRef('type_message').focusIn()