Skip to content

Commit f9551e0

Browse files
committed
Fixed issue where text selection lagged behind word highlight in editor upon pause. Text selection upon pause works now for both hotkeys and video controls.
1 parent 06d9a55 commit f9551e0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/lib/TranscriptEditor/MediaPlayer/VideoPlayer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class VideoPlayer extends React.Component {
1313
data-testid="media-player-id"
1414
onClick={ this.props.onClick }
1515
onLoadedData={ this.props.onLoadedDataGetDuration }
16+
onPause={ this.props.videoHasPaused }
1617
ref={ this.props.videoRef }
1718
/>
1819
);
@@ -24,7 +25,8 @@ VideoPlayer.propTypes = {
2425
onTimeUpdate: PropTypes.func,
2526
onClick: PropTypes.func,
2627
videoRef: PropTypes.object,
27-
onLoadedDataGetDuration: PropTypes.func
28+
onLoadedDataGetDuration: PropTypes.func,
29+
videoHasPaused: PropTypes.func
2830
};
2931

3032
export default VideoPlayer;

src/lib/TranscriptEditor/MediaPlayer/defaultHotKeys.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ function returnHotKeys(self) {
44
priority: 1,
55
handler: () => {
66
self.togglePlayMedia();
7-
if (!self.isPlaying() && self.props.focusOnPause) {
8-
self.props.setFocus();
9-
}
107

118
self.props.handleAnalyticsEvents({
129
category: 'defaultHotKeys',

src/lib/TranscriptEditor/MediaPlayer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ class MediaPlayer extends React.Component {
412412
onClick= { this.togglePlayMedia.bind(this) }
413413
videoRef={ this.videoRef }
414414
onLoadedDataGetDuration={ this.onLoadedDataGetDuration }
415+
videoHasPaused= { this.props.setFocus }
415416
/>;
416417

417418
const playerControlsSection = (
@@ -470,7 +471,6 @@ MediaPlayer.propTypes = {
470471
rollBackValueInSeconds: PropTypes.number,
471472
timecodeOffset: PropTypes.number,
472473
setFocus: PropTypes.func,
473-
focusOnPause: PropTypes.bool,
474474
};
475475

476476
export default hotkeys(MediaPlayer);

src/lib/TranscriptEditor/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ class TranscriptEditor extends React.Component {
234234
}
235235

236236
handleSetFocus = () => {
237-
this.setFocus();
237+
if (this.state.focusOnPause) {
238+
this.setFocus();
239+
}
238240
}
239241

240242
getEditorContent = (exportFormat) => {
@@ -259,7 +261,6 @@ class TranscriptEditor extends React.Component {
259261
handleAnalyticsEvents={ this.props.handleAnalyticsEvents }
260262
handleSaveTranscript={ this.handleSaveTranscript }
261263
setFocus = { this.handleSetFocus }
262-
focusOnPause = { this.state.focusOnPause }
263264
/>;
264265

265266
const settings = <Settings

0 commit comments

Comments
 (0)