@@ -170,30 +170,43 @@ export class StudioComponent implements OnDestroy, OnInit {
170170 } ,
171171 } ;
172172 this . shepherdService . keyboardNavigation = false ;
173- text_file_step [ "when" ] = {
174- show : ( ) => {
175- if ( this . upload ) {
176- this . studioService . inputMethod . text = "upload" ;
177- }
178- } ,
179- hide : ( ) => {
173+
174+ const cachedTextInputMode = this . studioService . inputMethod . text ;
175+ const setTextInputMode = ( mode : string ) => {
176+ return ( ) => {
180177 if ( this . upload ) {
181- this . studioService . inputMethod . text = "edit" ;
178+ this . studioService . inputMethod . text = mode ;
182179 }
183- } ,
180+ } ;
184181 } ;
185- audio_file_step [ "when" ] = {
186- show : ( ) => {
187- if ( this . upload ) {
188- this . studioService . inputMethod . audio = "upload" ;
189- }
190- } ,
191- hide : ( ) => {
182+
183+ text_write_step . when = {
184+ show : setTextInputMode ( "edit" ) ,
185+ hide : setTextInputMode ( cachedTextInputMode ) ,
186+ } ;
187+ text_file_step . when = {
188+ show : setTextInputMode ( "upload" ) ,
189+ hide : setTextInputMode ( cachedTextInputMode ) ,
190+ } ;
191+
192+ const cachedAudioInputMode = this . studioService . inputMethod . audio ;
193+ const setAudioInputMode = ( mode : string ) => {
194+ return ( ) => {
192195 if ( this . upload ) {
193- this . studioService . inputMethod . audio = "mic" ;
196+ this . studioService . inputMethod . audio = mode ;
194197 }
195- } ,
198+ } ;
196199 } ;
200+
201+ audio_record_step . when = {
202+ show : setAudioInputMode ( "mic" ) ,
203+ hide : setAudioInputMode ( cachedAudioInputMode ) ,
204+ } ;
205+ audio_file_step . when = {
206+ show : setAudioInputMode ( "upload" ) ,
207+ hide : setAudioInputMode ( cachedAudioInputMode ) ,
208+ } ;
209+
197210 if ( this . formIsDirty ( ) ) {
198211 step_one_final_step [ "text" ] =
199212 $localize `Once you've done this, you can click the "next step" button here to let Studio build your ReadAlong! (This may take a few seconds.)` +
0 commit comments