[libreoffice online] insert text in document programmatically

Hello!
I Want to write a string in the document programmatically when the user click in a button or menu. (like custom fields in libreoffice)

I tried with JS and cannot find a solution because of the data rendering in images by Libreoffice online.

Anyone know if itโ€™s possible and how can I do that?
Thanks

There is an example how to do that with PostMessage.
Please take an eye to the following url.

In this url, there is a method called โ€œinsertTextโ€ that may be be very usefull.