[Libreoffice online] write text in document programatically

Hello,
I’m using Libreoffice online and I want to add a menu that when is pressed write a string in the document.

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

Hi, I did a lot of tests and find the solution.
If you use a framed based solution, you can send this commands:

window.frames[0].postMessage(JSON.stringify({'MessageId': 'Host_PostmessageReady'}), '*');
window.frames[0].postMessage(JSON.stringify({'MessageId': 'CallPythonScript',
	 'SendTime': Date.now(),
	 'ScriptFile': 'InsertText.py',
	 'Function': 'InsertText',
	 'Values': {'text': {'type': 'string', 'value': '<<Text to insert>>'}}
	 }),
'*');

Are you using frame?

More details you can find here: loleaflet/reference.html - online - Gitiles

I have presented a webinar too, with plugins details: