Skip to content

Commit ae20053

Browse files
author
Pietro Passarelli
committed
1.3.4
fix optional analytics in keyboard shorcuts
1 parent 50da859 commit ae20053

File tree

2 files changed

+58
-50
lines changed

2 files changed

+58
-50
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@pietrop/react-transcript-editor",
33
"description": "A React component to make transcribing audio and video easier and faster.",
4-
"version": "1.3.3",
4+
"version": "1.3.4",
55
"keywords": [
66
"transcript",
77
"transcriptions",

packages/components/keyboard-shortcuts/hot-keys.js

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ function returnHotKeys(self) {
44
priority: 1,
55
handler: () => {
66
self.togglePlayMedia();
7-
8-
self.props.handleAnalyticsEvents({
9-
category: 'defaultHotKeys',
10-
action: 'alt+k',
11-
name: 'togglePlayMedia',
12-
value: 'na'
13-
});
7+
if(self.props.handleAnalyticsEvents){
8+
self.props.handleAnalyticsEvents({
9+
category: 'defaultHotKeys',
10+
action: 'alt+k',
11+
name: 'togglePlayMedia',
12+
value: 'na'
13+
});
14+
}
15+
1416
},
1517
displayKeyCombination: 'alt + k',
1618
label: 'Play Media'
@@ -19,13 +21,14 @@ function returnHotKeys(self) {
1921
priority: 1,
2022
handler: () => {
2123
self.skipForward();
22-
23-
self.props.handleAnalyticsEvents({
24-
category: 'defaultHotKeys',
25-
action: 'alt+l',
26-
name: 'skipForward',
27-
value: 'na'
28-
});
24+
if(self.props.handleAnalyticsEvents){
25+
self.props.handleAnalyticsEvents({
26+
category: 'defaultHotKeys',
27+
action: 'alt+l',
28+
name: 'skipForward',
29+
value: 'na'
30+
});
31+
}
2932
},
3033
displayKeyCombination: 'alt + l',
3134
label: 'Fast Forward'
@@ -34,13 +37,14 @@ function returnHotKeys(self) {
3437
priority: 1,
3538
handler: () => {
3639
self.skipBackward();
37-
38-
self.props.handleAnalyticsEvents({
39-
category: 'defaultHotKeys',
40-
action: 'alt+j',
41-
name: 'skipBackward',
42-
value: 'na'
43-
});
40+
if(self.props.handleAnalyticsEvents){
41+
self.props.handleAnalyticsEvents({
42+
category: 'defaultHotKeys',
43+
action: 'alt+j',
44+
name: 'skipBackward',
45+
value: 'na'
46+
});
47+
}
4448
},
4549
displayKeyCombination: 'alt + j',
4650
label: 'Rewind'
@@ -49,13 +53,14 @@ function returnHotKeys(self) {
4953
priority: 1,
5054
handler: () => {
5155
self.decreasePlaybackRate();
52-
53-
self.props.handleAnalyticsEvents({
54-
category: 'defaultHotKeys',
55-
action: 'alt+-',
56-
name: 'decreasePlaybackRate',
57-
value: 'na'
58-
});
56+
if(self.props.handleAnalyticsEvents){
57+
self.props.handleAnalyticsEvents({
58+
category: 'defaultHotKeys',
59+
action: 'alt+-',
60+
name: 'decreasePlaybackRate',
61+
value: 'na'
62+
});
63+
}
5964
},
6065
displayKeyCombination: 'alt + -',
6166
label: 'Decrease Playback Speed'
@@ -65,13 +70,14 @@ function returnHotKeys(self) {
6570
priority: 1,
6671
handler: () => {
6772
self.increasePlaybackRate();
68-
69-
self.props.handleAnalyticsEvents({
70-
category: 'defaultHotKeys',
71-
action: 'alt+plus',
72-
name: 'increasePlaybackRate',
73-
value: 'na'
74-
});
73+
if(self.props.handleAnalyticsEvents){
74+
self.props.handleAnalyticsEvents({
75+
category: 'defaultHotKeys',
76+
action: 'alt+plus',
77+
name: 'increasePlaybackRate',
78+
value: 'na'
79+
});
80+
}
7581
},
7682
displayKeyCombination: 'alt + +',
7783
label: 'Increase Playback Speed'
@@ -80,13 +86,14 @@ function returnHotKeys(self) {
8086
priority: 1,
8187
handler: () => {
8288
self.rollBack();
83-
84-
self.props.handleAnalyticsEvents({
85-
category: 'defaultHotKeys',
86-
action: 'alt+r',
87-
name: 'rollBack',
88-
value: 'na'
89-
});
89+
if(self.props.handleAnalyticsEvents){
90+
self.props.handleAnalyticsEvents({
91+
category: 'defaultHotKeys',
92+
action: 'alt+r',
93+
name: 'rollBack',
94+
value: 'na'
95+
});
96+
}
9097
},
9198
displayKeyCombination: 'alt + r',
9299
label: 'Roll Back'
@@ -95,13 +102,14 @@ function returnHotKeys(self) {
95102
priority: 1,
96103
handler: () => {
97104
self.promptSetCurrentTime();
98-
99-
self.props.handleAnalyticsEvents({
100-
category: 'defaultHotKeys',
101-
action: 'alt+t',
102-
name: 'promptSetCurrentTime',
103-
value: 'na'
104-
});
105+
if(self.props.handleAnalyticsEvents){
106+
self.props.handleAnalyticsEvents({
107+
category: 'defaultHotKeys',
108+
action: 'alt+t',
109+
name: 'promptSetCurrentTime',
110+
value: 'na'
111+
});
112+
}
105113
},
106114
displayKeyCombination: 'alt + t',
107115
label: 'set current time'

0 commit comments

Comments
 (0)