File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
projects/voicecapture-angular/src/lib Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export class VoiceCapture implements OnInit {
26
26
@Input ( ) start : WritableSignal < boolean > = signal ( false ) ;
27
27
@Input ( ) lang : string = 'en' ;
28
28
@Input ( ) mode : string = 'fullscreen' ;
29
+ @Input ( ) clipboard : boolean = false ;
29
30
@Output ( ) voiceTranscript = new EventEmitter < string > ( ) ;
30
31
31
32
finalTranscript : string = '' ;
@@ -164,6 +165,16 @@ export class VoiceCapture implements OnInit {
164
165
this . updateText ( interimTranscript || this . finalTranscript ) ;
165
166
166
167
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
+ }
167
178
this . voiceTranscript . emit ( this . finalTranscript ) ;
168
179
this . deactivateVoice ( ) ;
169
180
}
You can’t perform that action at this time.
0 commit comments