-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I want to get current caret position. For example, for the image below:

I would like to get cursor position 2 (0 being the initial cursor position, if text was empty)
Normally I would achieve using something like this:
const handleOnClick = () => {
if (inputRef.current && inputRef.current.inputRef) {
const { selectionStart, selectionEnd } = inputRef.current.inputRef;
console.log('Selection Start:', selectionStart);
console.log('Selection End:', selectionEnd);
}
}
<MarkedInput
ref={inputRef}
Mark={RemovableMark}
value={value}
onChange={onChange}
/>
But inputRef doesn't jave current inputRef, so I can't use selectionStart and selectionEnd.
Metadata
Metadata
Assignees
Labels
No labels