[Client] Implement copy file url to clipboard

This commit is contained in:
syuilo
2017-02-25 16:30:18 +09:00
parent dd9ff67628
commit 0c33053fcf
2 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
/**
* Clipboardに値をコピー(TODO: 文字列以外も対応)
*/
module.exports = 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;
};