Skip to content

Commit

Permalink
Warn if clipboard access is prevented
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Apr 10, 2024
1 parent 8904c0c commit 9f37ce9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/util/clipboardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { isBrowser, isFirefox } from './pwaUtils';
export function copyToClipboard(text: string, typeLabel: string) {
if (!isBrowser)
return;
if (!window.navigator.clipboard?.writeText) {
alert('Clipboard access is blocked. Please enable it in your browser settings.');
return;
}
window.navigator.clipboard.writeText(text)
.then(() => {
addSnackbar({
Expand Down

0 comments on commit 9f37ce9

Please sign in to comment.