Hello, I have been struggling making a copy to clipboard button using UIKit. We plan to use this app in our jira internally so security is of little concern. After googling I concluded that using the iframe from CustomUI makes writing to clipboard possible. But the app is already done using UIKit, and rewriting it to be in an iframe is a hassle at this point. Can anyone provide me with a solution to fix this issue.
const copyToClipboard = (text) => {
navigator.clipboard.writeText(text)
.then(() => {
console.log('Text copied to clipboard: ', text);
})
.catch(err => {
console.error('Failed to copy text: ', err);
setError('Failed to copy text: ' + err);
});
}
Failed to copy text: NotAllowedError: Failed to execute 'writeText' on 'Clipboard': Write permission denied.