Skip to content

Commit 06d9a55

Browse files
committed
Focus on Pause can be deactivated in the settings
1 parent 9582c36 commit 06d9a55

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

src/lib/TranscriptEditor/MediaPlayer/defaultHotKeys.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function returnHotKeys(self) {
44
priority: 1,
55
handler: () => {
66
self.togglePlayMedia();
7-
if (!self.isPlaying()) {
7+
if (!self.isPlaying() && self.props.focusOnPause) {
88
self.props.setFocus();
99
}
1010

src/lib/TranscriptEditor/MediaPlayer/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ MediaPlayer.propTypes = {
470470
rollBackValueInSeconds: PropTypes.number,
471471
timecodeOffset: PropTypes.number,
472472
setFocus: PropTypes.func,
473+
focusOnPause: PropTypes.bool,
473474
};
474475

475476
export default hotkeys(MediaPlayer);

src/lib/TranscriptEditor/Settings/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ class Settings extends React.Component {
6666
/>
6767
</section>
6868

69+
<section className={ style.settingElement }>
70+
<div className={ style.label }>Focus On Pause</div>
71+
<Toggle
72+
defaultValue={ this.props.focusOnPause }
73+
label={ 'Set Focus On Pause' }
74+
handleToggle={ this.props.handleFocusOnPause }
75+
/>
76+
</section>
77+
6978
<section className={ style.settingElement }>
7079
<div className={ style.timecodeLabel }>Timecode Offset ℹ</div>
7180
<TimecodeOffset
@@ -83,9 +92,11 @@ class Settings extends React.Component {
8392
Settings.propTypes = {
8493
showTimecodes: PropTypes.bool,
8594
showSpeakers: PropTypes.bool,
95+
focusOnPause: PropTypes.bool,
8696
timecodeOffset: PropTypes.number,
8797
handleShowTimecodes: PropTypes.func,
8898
handleShowSpeakers: PropTypes.func,
99+
handleFocusOnPause: PropTypes.func,
89100
handleSetTimecodeOffset: PropTypes.func,
90101
handleSettingsToggle: PropTypes.func,
91102
handlePauseWhileTyping: PropTypes.func,

src/lib/TranscriptEditor/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class TranscriptEditor extends React.Component {
2727
rollBackValueInSeconds: 15,
2828
timecodeOffset: 0,
2929
showTimecodes: true,
30+
focusOnPause: true,
3031
showSpeakers: true
3132
};
3233
this.timedTextEditorRef = React.createRef();
@@ -188,6 +189,20 @@ class TranscriptEditor extends React.Component {
188189
}
189190
}
190191

192+
handleFocusOnPause = (e) => {
193+
const isChecked = e.target.checked;
194+
this.setState({ focusOnPause: isChecked });
195+
196+
if (this.props.handleAnalyticsEvents !== undefined) {
197+
this.props.handleAnalyticsEvents({
198+
category: 'TranscriptEditor',
199+
action: 'handleFocusOnPause',
200+
name: 'focusOnPause',
201+
value: isChecked
202+
});
203+
}
204+
}
205+
191206
handleSettingsToggle = () => {
192207
this.setState(prevState => ({
193208
showSettings: !prevState.showSettings
@@ -244,6 +259,7 @@ class TranscriptEditor extends React.Component {
244259
handleAnalyticsEvents={ this.props.handleAnalyticsEvents }
245260
handleSaveTranscript={ this.handleSaveTranscript }
246261
setFocus = { this.handleSetFocus }
262+
focusOnPause = { this.state.focusOnPause }
247263
/>;
248264

249265
const settings = <Settings
@@ -254,11 +270,13 @@ class TranscriptEditor extends React.Component {
254270
timecodeOffset={ this.state.timecodeOffset }
255271
showTimecodes={ this.state.showTimecodes }
256272
showSpeakers={ this.state.showSpeakers }
273+
focusOnPause={ this.state.focusOnPause }
257274
handlePauseWhileTyping={ this.handlePauseWhileTyping }
258275
handleIsScrollIntoViewChange={ this.handleIsScrollIntoViewChange }
259276
handleRollBackValueInSeconds={ this.handleRollBackValueInSeconds }
260277
handleSetTimecodeOffset={ this.handleSetTimecodeOffset }
261278
handleShowTimecodes={ this.handleShowTimecodes }
279+
handleFocusOnPause={ this.handleFocusOnPause }
262280
handleShowSpeakers={ this.handleShowSpeakers }
263281
handleAnalyticsEvents={ this.props.handleAnalyticsEvents }
264282
/>;

0 commit comments

Comments
 (0)