Skip to content

Commit 017f924

Browse files
committed
Fixed bug where error was thrown on pausing edited script with hotkeys
1 parent fd5beaf commit 017f924

File tree

1 file changed

+4
-3
lines changed
  • src/lib/TranscriptEditor/TimedTextEditor

1 file changed

+4
-3
lines changed

src/lib/TranscriptEditor/TimedTextEditor/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,16 +494,17 @@ class TimedTextEditor extends React.Component {
494494
// TODO: using convertToRaw here might be slowing down performance(?)
495495
const contentStateConvertEdToRaw = convertToRaw(contentState);
496496
const blocks = contentStateConvertEdToRaw.blocks;
497+
const entityMap = contentStateConvertEdToRaw.entityMap;
497498

498499
for (var blockIdx in blocks) {
499500
const currentBlock = blocks[blockIdx];
500501
const blockKey = currentBlock.key;
501-
const words = currentBlock.data.words;
502502
const ranges = currentBlock.entityRanges;
503503

504-
for (var idx in words) {
504+
for (var idx in ranges) {
505505
const range = ranges[idx];
506-
const word = words[idx];
506+
// Need to access entityMap and not currentBlock.data.words, as it seems to be not in sync with edits.
507+
const word = entityMap[range.key].data;
507508

508509
if (word.start <= this.props.currentTime) {
509510
currentFocus.blockKey = blockKey;

0 commit comments

Comments
 (0)