mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
save: ability to copy-to-clipboard
This commit is contained in:
parent
e53ef85ae9
commit
f4e2142b15
5 changed files with 61 additions and 6 deletions
|
@ -33,3 +33,14 @@ export const pushLoaderState = state => {
|
|||
export const pushNetworkInitError = state => {
|
||||
document.getElementById('loader-error').style.opacity = 1;
|
||||
};
|
||||
|
||||
export const copyToClipboard = str => {
|
||||
const el = document.createElement('textarea');
|
||||
el.value = str;
|
||||
el.setAttribute('readonly', '');
|
||||
el.style = { position: 'absolute', left: '-9999px' };
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(el);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue