bbc / react-transcript-editor

A React component to make correcting automated transcriptions of audio and video easier and faster. By BBC News Labs. - Work in progress
https://bbc.github.io/react-transcript-editor
Other
565 stars 163 forks source link

Add property to disable auto save #218

Open mitchell-bu opened 4 years ago

mitchell-bu commented 4 years ago

Is your feature request related to a problem? Please describe. When editing larger transcripts, we are noticing that the component becomes unresponsive while it is handling the auto save. We don't care about capturing all of the changes as they happen and instead prefer to wait until the user switches back out of editing mode to capture the new content.

Describe the solution you'd like I would like to add a new property, IsAutoUpdateOn, to the editor components. When set to true, the autosave will be skipped in the onChange method.

Describe alternatives you've considered We've considered setting the handleAutoSaveChanges function to null, but the component throws an unhandled exception when this happens. This can actually be observed in the demo site. image Also, if this function is null, there is currently no way to get the modified content once editing is complete. So we will still need this function to fire when the isEditable changes to false. This means that handleAutoSaveChanges becomes a bit of a misnomer. I suppose one option here is instead of adding a new bool property, we can add a new function property for handleEditingComplete. And then the logic becomes to check if the function is defined before going into the execution blocks.

Additional context I have forked this repo and will be making these changes as they are necessary for the acceptable performance in our situation. If you think these changes hold merit and would be useful for others, I will create a PR to pull them in here.

pietrop commented 4 years ago

There's a chance auto save might be causing this issue https://github.com/bbc/react-transcript-editor/issues/150, so a PR would be great to evaluate if it addressed this problem for media over 1 hour as well.