Skip to content

Commit

Permalink
trying out laurian's performance fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Pietro Passarelli - News Labs committed Aug 13, 2019
1 parent 6cfca7b commit 486b8a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 154 deletions.
156 changes: 3 additions & 153 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"prop-types": "^15.6.2",
"react-keyboard-shortcuts": "^1.1.3",
"react-simple-tooltip": "^2.3.3",
"react-visibility-sensor": "^5.1.1",
"sbd": "^1.0.15",
"smpte-timecode": "^1.2.3"
},
Expand Down
8 changes: 7 additions & 1 deletion packages/components/timed-text-editor/WrapperBlock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { EditorBlock, Modifier, EditorState, SelectionState } from 'draft-js';
import VisibilitySensor from 'react-visibility-sensor';

import SpeakerLabel from './SpeakerLabel';
// import { shortTimecode, secondsToTimecode } from '../../Util/timecode-converter/';
Expand Down Expand Up @@ -146,7 +147,12 @@ class WrapperBlock extends React.Component {
{this.props.blockProps.showTimecodes ? timecodeElement : ''}
</div>
<div className={ style.text }>
<EditorBlock { ...this.props } />
<VisibilitySensor partialVisibility={ true }>
{({ isVisible }) => isVisible ?
<EditorBlock { ...this.props } />
: <div contentEditable={ false }>{ this.props.block.text }</div>
}
</VisibilitySensor>
</div>
</div>
);
Expand Down

0 comments on commit 486b8a5

Please sign in to comment.