mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-21 01:58:10 +09:00
ac225d4ea6
Closes #12, #227 and #58
14 lines
320 B
JavaScript
14 lines
320 B
JavaScript
/**
|
|
* 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;
|
|
};
|