Add text to textarea on the cursor position

Hello
Can you help me please with the problem add text to textarea on the cursor position?
I try to add text to the text area on the cursor position but i don't have still cursor position.
I tried this.textarea8.selectionStart; in on change event for TextArea as you can see in the picture.
But it doesn't function.

Then I tried to add code to the component as a function with parameter but I don't know how I can call this function. It is the second picture.

Thank you

You can use the Execute code action to invoke custom TypeScript code. You will have to case this to any though:

(<any>this).getCursorPosition(name)
1 Like

Perfect thank you here is my solution.
this is an event click on button

and here is my code in component:

Thank you