Clipboard and selection APIs

Retool has utils.copyToClipboard() but otherwise does not seem to have a coherent set of select/copy/paste operations. In particular my immediate need is some way of reading text the user has selected in an html column table cell, or more generally, that, or any html component.

I tried window.getSelection() which does not seem to work (the function does not throw an error but the following does not return anything:

const selection = window.getSelection();
const text = selection.toString();

document.getSelection() doesn't work either.

My reading of the documentation suggests there are a lot of scenarios where these may not work. It seems like this is a reason Retool should provide them in a native Retool API form.

@Jack_T

Thank you for posting this!

Feature request has been filed to out IDE team, hoping to get a new util method out soon!