Hi, I would like to add possibility to copy Jira key and summary to clipboard from Issue view. I created app with jira:issueaction module, but I am unable to access navigator object to use clipboard.writeText function. It there any way to do that? Or are there any other options how to put data to clipboard (maybe not using Forge).
Thanks
It looks like Custom UI can.
That’s right, you can access the navigator in Custom UI. Something like this will work:
<button onClick={() => {navigator.clipboard.writeText("Text to copy");}}>Copy to clipboard</button>
Hey @AdamMoore, I can’t implement this getting error
Uncaught (in promise) DOMException: The Clipboard API has been blocked because of a permissions policy applied to the current document. See https://goo.gl/EuHzyv for more details.
Could you please assist me in resolving this error.
Are you trying to read from the clipboard maybe? The permissions only allow for write https://developer.atlassian.com/platform/forge/custom-ui/iframe/#feature-policies
@AdamMoore , I’m curious if I can do the same if I build an app with UI Kit.
I tried something like that:
<Button appearance='primary'
onClick={ () => navigator.clipboard.writeText("Forge") }>
Copy
</Button>
But I got this error:
Failed to execute 'writeText' on 'Clipboard': Document is not focused.
Is there a workaround?
Thank you very much.