From b4586f3fa34602bac8607e515e4a5d5c2253f0b6 Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Tue, 12 Nov 2024 21:11:23 -0300 Subject: [PATCH 1/4] add clipboard in example --- src/app/example/example.component.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/example/example.component.html b/src/app/example/example.component.html index ff081c7..f6d043f 100644 --- a/src/app/example/example.component.html +++ b/src/app/example/example.component.html @@ -43,6 +43,7 @@ (voiceTranscript)="returnVoiceTranscript($event)" [lang]="langSelect" [mode]="modeSelect" + [clipboard]="true" /> From 739d069da14aa634a0668f5b4d9cc7d5b9fd4731 Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Tue, 12 Nov 2024 21:11:34 -0300 Subject: [PATCH 2/4] feat: new clipboard --- .../src/lib/voicecapture-angular.component.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/projects/voicecapture-angular/src/lib/voicecapture-angular.component.ts b/projects/voicecapture-angular/src/lib/voicecapture-angular.component.ts index 1746351..b32c0ae 100644 --- a/projects/voicecapture-angular/src/lib/voicecapture-angular.component.ts +++ b/projects/voicecapture-angular/src/lib/voicecapture-angular.component.ts @@ -26,6 +26,7 @@ export class VoiceCapture implements OnInit { @Input() start: WritableSignal = signal(false); @Input() lang: string = 'en'; @Input() mode: string = 'fullscreen'; + @Input() clipboard: boolean = false; @Output() voiceTranscript = new EventEmitter(); finalTranscript: string = ''; @@ -164,6 +165,16 @@ export class VoiceCapture implements OnInit { this.updateText(interimTranscript || this.finalTranscript); if (this.finalTranscript) { + if (this.clipboard) { + navigator.clipboard.writeText(this.finalTranscript).then( + () => { + console.log('Text copied to clipboard'); + }, + (err) => { + console.error('Could not copy text to clipboard', err); + } + ); + } this.voiceTranscript.emit(this.finalTranscript); this.deactivateVoice(); } From f345ab10992d6951ba10ba29e4af40b2ca66f03e Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Tue, 12 Nov 2024 21:11:56 -0300 Subject: [PATCH 3/4] improvement aria attr --- .../lib/voicecapture-angular.component.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/projects/voicecapture-angular/src/lib/voicecapture-angular.component.html b/projects/voicecapture-angular/src/lib/voicecapture-angular.component.html index 1945d7a..f9393e0 100644 --- a/projects/voicecapture-angular/src/lib/voicecapture-angular.component.html +++ b/projects/voicecapture-angular/src/lib/voicecapture-angular.component.html @@ -4,16 +4,27 @@ (click)="deactivateVoice()" [ngClass]="mode" > - -

-