Closed juniorjp closed 3 years ago
What browser? Any example? jsfiddle.net
Hi @mervick , how are you? The problem is this in the stack: https://stackoverflow.com/questions/63307114/get-the-cursor-position-in-a-text-that-has-emojis-and-insert-tags My function passes the wrong position, if there is an emoji in some part of the text.
@mervick , what we are trying to achieve is getting the last cursor position inside the contenteditable
div, that way we can insert "tags" in the correct place. I have updated the title of the issue and created a jsfiddle showing what we want to achieve:
https://jsfiddle.net/7u2khqpd/2
I appreciate any feedback :)
Sorry for the late reply.
selectionStart
works only for regular teaxtarea
or input
's, but emojionearea uses contenteditable
div, so where is no way to make selectionStart
works with div
element
https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
Hi, any way to solve this?