mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 03:42:27 +03: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,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…
Reference in New Issue
Block a user