[libreoffice online] insert text in document programmatically

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?

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.