@@ -29,6 +29,7 @@ class TranscriptEditor extends React.Component {
2929 showTimecodes : true ,
3030 showSpeakers : true
3131 } ;
32+ this . timedTextEditorRef = React . createRef ( ) ;
3233 }
3334
3435 static getDerivedStateFromProps ( nextProps ) {
@@ -69,10 +70,10 @@ class TranscriptEditor extends React.Component {
6970 }
7071
7172 ifPresentRetrieveTranscriptFromLocalStorage = ( ) => {
72- if ( this . refs . timedTextEditor !== undefined ) {
73- if ( this . refs . timedTextEditor . isPresentInLocalStorage ( this . props . mediaUrl ) ) {
73+ if ( this . timedTextEditorRef . current !== undefined ) {
74+ if ( this . timedTextEditorRef . current . isPresentInLocalStorage ( this . props . mediaUrl ) ) {
7475 console . info ( 'was already present in local storage' ) ;
75- this . refs . timedTextEditor . loadLocalSavedData ( this . props . mediaUrl ) ;
76+ this . timedTextEditorRef . current . loadLocalSavedData ( this . props . mediaUrl ) ;
7677 } else {
7778 console . info ( 'not present in local storage' ) ;
7879 }
@@ -155,7 +156,7 @@ class TranscriptEditor extends React.Component {
155156 this . setState ( { timecodeOffset : timecodeOffset } ,
156157 ( ) => {
157158 // eslint-disable-next-line react/no-string-refs
158- this . refs . timedTextEditor . forceUpdate ( ) ;
159+ this . timedTextEditorRef . current . forceUpdate ( ) ;
159160 } ) ;
160161 }
161162
@@ -218,11 +219,11 @@ class TranscriptEditor extends React.Component {
218219 }
219220
220221 getEditorContent = ( exportFormat ) => {
221- return this . refs . timedTextEditor . getEditorContent ( exportFormat ) ;
222+ return this . timedTextEditorRef . current . getEditorContent ( exportFormat ) ;
222223 }
223224
224225 handleSaveTranscript = ( ) => {
225- return this . refs . timedTextEditor . localSave ( this . props . mediaUrl ) ;
226+ return this . timedTextEditorRef . current . localSave ( this . props . mediaUrl ) ;
226227 }
227228
228229 render ( ) {
@@ -276,7 +277,7 @@ class TranscriptEditor extends React.Component {
276277 isPauseWhileTypingOn = { this . state . isPauseWhileTypingOn }
277278 showTimecodes = { this . state . showTimecodes }
278279 showSpeakers = { this . state . showSpeakers }
279- ref = { 'timedTextEditor' }
280+ ref = { this . timedTextEditorRef }
280281 handleAnalyticsEvents = { this . props . handleAnalyticsEvents }
281282 /> ;
282283
0 commit comments