13 lines
355 B
JavaScript
13 lines
355 B
JavaScript
|
export const clipboard = function(superClass) {
|
||
|
return class extends superClass {
|
||
|
copy(content) {
|
||
|
const txtEl = document.createElement('input');
|
||
|
txtEl.type = 'hidden';
|
||
|
document.body.appendChild(txtEl);
|
||
|
txtEl.value = content;
|
||
|
navigator.clipboard.writeText(content);
|
||
|
document.body.removeChild(txtEl);
|
||
|
}
|
||
|
};
|
||
|
};
|