Skip to content

Commit

Permalink
Copy to clipboard not working on Firefox (#1136)
Browse files Browse the repository at this point in the history
# fix: copy to clipboard not working on Firefox


## Description

In Conductor, copy to clipboard was not working on Firefox. 

## Proposed Changes

Remove browser dependent check that is not required, now works
cross-browser.

## How to Test

In Conductor on the main page, click "Copy Token". On a notebook page,
create an
invite for the notebook and click "Copy Registration URL".   


## Checklist

- [x] I have confirmed all commits have been signed.
- [x] I have added JSDoc style comments to any new functions or classes.
- [x] Relevant documentation such as READMEs, guides, and class comments
are updated.
  • Loading branch information
stevecassidy authored Sep 4, 2024
2 parents ba017ae + 4211de4 commit 246f325
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
14 changes: 6 additions & 8 deletions api/views/home.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@

<script>
const copyTokenToClipboard = () => {
navigator.permissions.query({name: "clipboard-write"}).then((result) => {
if (result.state === "granted" || result.state === "prompt") {
navigator.clipboard.writeText("{{{token}}}").then(() => {
alert("Bearer token copied to clipboard.")
}, () => {
alert("Could not copy token.")
});
}
navigator.clipboard.writeText("{{{token}}}").then(() => {
alert("Bearer token copied to clipboard.")
}, () => {
alert("Could not copy token.")
});
}
</script>
14 changes: 4 additions & 10 deletions api/views/notebook-landing.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,12 @@
</div>
</div>



<script>
const copyToClipboard = (text) => {
navigator.permissions.query({name: "clipboard-write"}).then((result) => {
if (result.state === "granted" || result.state === "prompt") {
navigator.clipboard.writeText(text).then(() => {
alert("Copied to clipboard.")
}, () => {
alert("Could not copy text.")
});
}
navigator.clipboard.writeText(text).then(() => {
alert("URL copied to clipboard.")
}, () => {
alert("Could not copy URL to clipboard.")
});
}
Expand Down

0 comments on commit 246f325

Please sign in to comment.