Closed ghost closed 3 years ago
Hi @img-play I think you are encountering a race condition. Where you try to initialize the slate-transcript-editor component without having first passed the transcript json data. You can add a check to only to that if the transcript json data is available.
{this.state.transcriptJson !== null && (
<TranscriptEditor
transcriptData={this.state.transcriptJson} // Transcript json
mediaUrl={this.state.url} // string url to media file - audio or video
// showTitle={true}
isEditable={true} // se to true if you want to be able to edit the text
title={this.state.transcriptTitle}
mediaType={mediaType}
autoSaveContentType={'digitalpaperedit'}
handleSaveEditor={this.handleSave}
// handleAutoSaveChanges={ this.handleSave }
/>
)}
You can also see it in context here pietrop/digital-paper-edit-client/src/Components/Transcripts/TranscriptCorrect.js#L153 and here pietrop/digital-paper-edit-firebase/src/Components/Transcripts/TranscriptCorrect.js
Ps: I am converting this issue to a discussion.
Hi,
I am wondering if you might be able to point me in the right direction. I am able to get the editor running in a React app (create-react-app) with a static JSON transcript:
But I am struggling to make the editor accept an object which is not fetched using an import statement. The following function returns the exact same JSON object as
test.json
:When I replace
import TRANSCRIPT_DATA from './test';
withconst TRANSCRIPT_DATA = loadTranscriptData();
(and of course import the file where the function lives), the editor still loads but does not display the contents of the transcript, only some generic strings.So I'm asking this in case I am missing something obvious or in case you're supposed to load dynamic JSON into the editor using a different method. Any little pointer is highly appreciated.
Best, David Trasbo