mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🐛 Fixed copy-to-clipboard buttons in Chrome + Firefox
no issue - the method we used for copying text to the clipboard for older browsers has broken on some newer browsers - the more modern `navigator.clipboard.writeText` API is now universally supported by our target browsers so we're able to switch to that instead which is working across the board
This commit is contained in:
parent
a15cc41f03
commit
6155645a45
1 changed files with 1 additions and 9 deletions
|
@ -1,11 +1,3 @@
|
|||
export default function copyTextToClipboard(text) {
|
||||
let textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.setAttribute('readonly', '');
|
||||
textarea.style.position = 'absolute';
|
||||
textarea.style.left = '-9999px';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
navigator.clipboard.writeText(text);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue