pietrop / slate-transcript-editor

A React component to make correcting automated transcriptions of audio and video easier and faster. Using the SlateJs editor.
https://pietrop.github.io/slate-transcript-editor
Other
75 stars 33 forks source link

copy paste re-aligning issue #25

Closed pietrop closed 3 years ago

pietrop commented 3 years ago

Describe the bug

On thing that was cool in the way that react-transcript-editor was going the alignment is that you could drop in any test via copy paste and it would try it's best to align it and restore the time-codes.

RTE

As you can see here on paste, the time-codes are self updating, coz alignment is triggered on change.

Slate doos it's alignment slightly differently. So you can't achieve the same result

To Reproduce Steps to reproduce the behavior:

  1. Go to demo or run storybook locally
  2. export as plain text, open copy paste
  3. select the whole text in the editor and delete
  4. paste your selection from the text file into the editor
  5. See error

see gif below STE-bug

Expected behavior

I'd expect slate-transcript-editor to behave the same as react-transcript-editor in this instance.

Additional context

react-transcript-editor uses UpdateTimestamps which converts the slate value content into plain text and uses stt-align-node to re-align it with the dpe transcript from props. It then uses the info from slate paragraphs to add the aligned words back to the paragraphs.

That modules it's heavily dependent on the draftJs data structure, it needs to be converted to handle the slateJs one.

on the other hand slate-transcript-editor uses align-diarized-text which as stt-align-node as one of it's dependencies.

pietrop commented 3 years ago

fixed in #27