#1448, add copyToClipboard controller action

This commit is contained in:
Ahmed Ejaz 2023-11-12 02:46:41 +05:00 committed by Andreas Nedbal
parent 93d67a8307
commit e7f2582f59
1 changed files with 7 additions and 1 deletions

View File

@ -5,12 +5,14 @@ export default class extends Controller {
static values = {
url: String,
text: String,
title: String
title: String,
copyContent: String
};
declare readonly urlValue: string;
declare readonly textValue: string;
declare readonly titleValue: string;
declare readonly copyContentValue: string;
share() {
let shareConfiguration = {};
@ -42,4 +44,8 @@ export default class extends Controller {
})
.catch(noop);
}
async copyToClipboard(){
await navigator.clipboard.writeText(this.copyContentValue)
}
}