Button to modify text area content at insertion point

Hello all
I am working on a markdown editor and have run into a problem regarding text insertion based on buttons. What I am trying to do is make a button that will insert a preformatted string containing the url to an uploaded file.

The uploading of the file and populating the dropdown works already, but the issue arises with insertion.

As far as I can tell, there is no way to know where the insertion point is inside a text area (flashing line when typing, also called cursor, but not to be confused with mouse cursor). Due to this, text could only be appended or prepended to the entire area.

I am trying to create something extremely similar to the link button in this very comment writer.

Is there a way to insert text at the cursor based on a button press?

I have tried the Java Robot, and copy to clipboard to have the user paste in, but due to Ignition running on a debian server, it is headless and both operations fail, blaming the headless for it.

Please let me know
Thank you

Dont think its possible with java as in perspective you are using javascript, so you will need javascript for that, for which you would need a custom module.

Copy clipboard usually doesnt work in the browser tho as it is protected, maybe try a different insert methoded with robot. but i doubt it will work

The robot from Java also does not work in perspective. The robot = Robot() line fails not due to imports but because of this issue
Thank you for this info though.

yeah i thought so…
You will need js acces for this
or ask for a feature to add in a copy to clipboard function than the user would just have to paste it where they want. and a general copy to clipboard might be accepted as feature