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

edge case: single word in paragraph block, adding other words and aligning freezes the UI #43

Closed pietrop closed 3 years ago

pietrop commented 3 years ago

Describe the bug

edge case, when there's a single word in paragraph block, if you add another word and then run alignmenet, either by saving, clicking ♻️ btn, or hitting enter. It freezes the UI

To Reproduce Steps to reproduce the behavior:

  1. Go to storybook demo
  2. remove all but one words in a short paragraph
  3. click ♻️ align btn
  4. That's your starting point
  5. add more words eg "test test"
  6. go back to the space before the last word you added hit enter
  7. See error - UI freezes.

Correction: even doing up to step 3 will freeze the UI. (one word to be aligned to what before was a longer paragraph seems to fail/freeze the UI).

Expected behavior

UI not to freze Screenshots

Eg last paragraph block in this example below is one word when I add "test test" and hit enter before the last "test" word it freezes the UI.

Screen Shot 2021-02-24 at 1 31 36 AM

Additional context

NA

Might need re-thinking either stt-align-node further upstream or the update timestamps module in this repo that wraps around it. To look for and handle this edge case. Worth also considering how many words is a minimum for alignment module to work, eg would it work with 2? or needs to be more?

pietrop commented 3 years ago

https://github.com/pietrop/digital-paper-edit-electron/issues/63

pietrop commented 3 years ago

more straightforward way of reproducing.

  1. Go to a paragraph.
  2. Hit enter after the first word
  3. Go to beginning of the paragraph
  4. insert a new word
  5. click the align btn
  6. see that it freezes

ste-bug-1

pietrop commented 3 years ago

closing, see https://github.com/pietrop/digital-paper-edit-electron/issues/74#issuecomment-844404845

But new issue can be created if this shows up again.