Skip to content

Commit 739d069

Browse files
feat: new clipboard
1 parent b4586f3 commit 739d069

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

projects/voicecapture-angular/src/lib/voicecapture-angular.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class VoiceCapture implements OnInit {
2626
@Input() start: WritableSignal<boolean> = signal(false);
2727
@Input() lang: string = 'en';
2828
@Input() mode: string = 'fullscreen';
29+
@Input() clipboard: boolean = false;
2930
@Output() voiceTranscript = new EventEmitter<string>();
3031

3132
finalTranscript: string = '';
@@ -164,6 +165,16 @@ export class VoiceCapture implements OnInit {
164165
this.updateText(interimTranscript || this.finalTranscript);
165166

166167
if (this.finalTranscript) {
168+
if (this.clipboard) {
169+
navigator.clipboard.writeText(this.finalTranscript).then(
170+
() => {
171+
console.log('Text copied to clipboard');
172+
},
173+
(err) => {
174+
console.error('Could not copy text to clipboard', err);
175+
}
176+
);
177+
}
167178
this.voiceTranscript.emit(this.finalTranscript);
168179
this.deactivateVoice();
169180
}

0 commit comments

Comments
 (0)