diff options
author | 2021-08-14 19:13:46 +0200 | |
---|---|---|
committer | 2021-08-14 19:13:46 +0200 | |
commit | 26721219802be2ae9655943e610554a1b47eafbd (patch) | |
tree | d1cd5bf34ee9ef05ea07c35b8f77c39ddac2d4c2 /apps/Notes/helpers/copyToClipboard.js | |
parent | f6557f602f5124d5c90019cd90cf5257dbc00ef5 (diff) | |
download | my_apps-26721219802be2ae9655943e610554a1b47eafbd.tar.gz my_apps-26721219802be2ae9655943e610554a1b47eafbd.tar.bz2 my_apps-26721219802be2ae9655943e610554a1b47eafbd.zip |
copy to clipboard, icons, notes key
Diffstat (limited to 'apps/Notes/helpers/copyToClipboard.js')
-rw-r--r-- | apps/Notes/helpers/copyToClipboard.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/Notes/helpers/copyToClipboard.js b/apps/Notes/helpers/copyToClipboard.js new file mode 100644 index 0000000..608d299 --- /dev/null +++ b/apps/Notes/helpers/copyToClipboard.js @@ -0,0 +1,19 @@ +const copyToClipboard = (text, setPopup) => { + navigator + .clipboard.writeText(text) + .then(() => { + setPopup({ + content: 'Note content was copied to clipboard', + time: 2000, + }) + }) + .catch(() => { + setPopup({ + content: 'Could not copy to clipboard', + time: 2000, + error: true + }) + }) +} + +export default copyToClipboard |