2017-02-24 23:30:18 -08:00
|
|
|
/**
|
|
|
|
* Clipboardに値をコピー(TODO: 文字列以外も対応)
|
|
|
|
*/
|
2017-03-18 04:05:11 -07:00
|
|
|
export default val => {
|
2017-02-24 23:30:18 -08:00
|
|
|
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;
|
|
|
|
};
|