hperrin / svelte-material-ui

Svelte Material UI Components
https://sveltematerialui.com/
Apache License 2.0
3.27k stars 287 forks source link

Expose cursor position index on click of TextField #645

Open hi-brylle opened 4 months ago

hi-brylle commented 4 months ago

Is there a way to determine the cursor position index upon click of TextField with a non-empty string in it? I can't find it in the documentation. Also tried hunting it in the source code but I just can't find it, if it ever exists.

Thanks.

P.S. I use this library in an embedded GUI app with a touch panel in tandem with https://github.com/russellsamora/svelte-keyboard. Every keypress in that library effectively returns a char in a callback; I am free to put this char anywhere in some string. Usually, the chars are appended to the end of that, but there's complications if the user of the app clicks the TextField somewhere in between the string, hence I need the cursor position.