Add some helpers

This commit is contained in:
2022-10-29 22:05:19 +02:00
parent 30634f7433
commit 9f5824fd41
3 changed files with 61 additions and 0 deletions

12
clipboard.js Normal file
View File

@ -0,0 +1,12 @@
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);
}
};
};