Add copyToClipboard so that adding a mixin is not necessary.
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
export const clipboard = function(superClass) {
|
||||
return class extends superClass {
|
||||
copy(content) {
|
||||
copyToClipboard(content);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const copyToClipboard = (content) => {
|
||||
const txtEl = document.createElement('input');
|
||||
txtEl.type = 'hidden';
|
||||
document.body.appendChild(txtEl);
|
||||
@@ -8,5 +14,3 @@ export const clipboard = function(superClass) {
|
||||
navigator.clipboard.writeText(content);
|
||||
document.body.removeChild(txtEl);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tp/helpers",
|
||||
"version": "2.7.1",
|
||||
"version": "2.8.0",
|
||||
"description": "",
|
||||
"main": "closest.js",
|
||||
"scripts": {
|
||||
|
Reference in New Issue
Block a user