Advise on clipboard

I need some help with a clipboard tool. Below are some screenshots on what I am trying to accomplish.


The above picture is the set up. The plug in document viewer is on the left side and a rich text box is on the right. I have a button to upload a file and it is shown in the box on the left which is shown in the picture below.

I can highlight text and right click and you can see that a copy option is available. I can click the ‘copy’ and then right click on the rich text box and paste the text. But I want a button to do that work.

The goal is to have 1 button that on click copies the selected text to a clipboard and then pastes that text from the document viewer to the rich text box.

This is what I have tried.
1.) the aircopytoclipboard but it does not copy the text from the document viewer to the clipboard (maybe i need to adjust the settings)
2.) writing js code in the toolbox plugin. (can someone please reference the code for this because I used the (document.execCommand(‘copy’)) to no avail
3.) is there a way to bypass the clipboard by using my backend to select the data and then display it.
4.) download the document viewer and reader which returns the content of a document but not in the right format. Maybe use both the document viewer and the reader and word counter together. So the proper format of the presentation is displayed but whatever is highlighted could be searched with the viewer and word counter and displayed in the text box.

any help would be great as I have been spending a lot of time being stuck. Thank you very much for your time in advance.

Very Respectfully,

Josh Reissig