mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 10:13:08 +02:00
13 lines
320 B
TypeScript
13 lines
320 B
TypeScript
/**
|
|
* Clipboardに値をコピー(TODO: 文字列以外も対応)
|
|
*/
|
|
export default val => {
|
|
const form = document.createElement('textarea');
|
|
form.textContent = val;
|
|
document.body.appendChild(form);
|
|
form.select();
|
|
const result = document.execCommand('copy');
|
|
document.body.removeChild(form);
|
|
|
|
return result;
|
|
};
|