fixed issue of emoji not inserted between written texts

This commit is contained in:
sairaj mote 2024-02-01 02:14:46 +05:30
parent 02b92f6228
commit bbbb0c474b

View File

@ -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()