@@ -49,7 +49,7 @@ type Props = {|
49
49
contextSize : number ,
50
50
critical : boolean ,
51
51
showCode : boolean ,
52
- openInEditor : ( errorLoc : ErrorLocation ) => void ,
52
+ editorHandler : ( errorLoc : ErrorLocation ) => void ,
53
53
| } ;
54
54
55
55
type State = { |
@@ -85,17 +85,17 @@ class StackFrame extends Component<Props, State> {
85
85
return { fileName , lineNumber : lineNumber || 1 } ;
86
86
}
87
87
88
- openInEditor = ( ) => {
88
+ editorHandler = ( ) => {
89
89
const errorLoc = this . getErrorLocation ( ) ;
90
90
if ( ! errorLoc ) {
91
91
return ;
92
92
}
93
- this . props . openInEditor ( errorLoc ) ;
93
+ this . props . editorHandler ( errorLoc ) ;
94
94
} ;
95
95
96
96
onKeyDown = ( e : SyntheticKeyboardEvent < > ) => {
97
97
if ( e . key === 'Enter' ) {
98
- this . openInEditor ( ) ;
98
+ this . editorHandler ( ) ;
99
99
}
100
100
} ;
101
101
@@ -155,14 +155,15 @@ class StackFrame extends Component<Props, State> {
155
155
}
156
156
}
157
157
158
- const canOpenInEditor = this . getErrorLocation ( ) !== null ;
158
+ const canOpenInEditor =
159
+ this . getErrorLocation ( ) !== null && this . props . editorHandler !== null ;
159
160
return (
160
161
< div >
161
162
< div > { functionName } </ div >
162
163
< div style = { linkStyle } >
163
164
< a
164
165
style = { canOpenInEditor ? anchorStyle : null }
165
- onClick = { canOpenInEditor ? this . openInEditor : null }
166
+ onClick = { canOpenInEditor ? this . editorHandler : null }
166
167
onKeyDown = { canOpenInEditor ? this . onKeyDown : null }
167
168
tabIndex = { canOpenInEditor ? '0' : null }
168
169
>
@@ -172,7 +173,7 @@ class StackFrame extends Component<Props, State> {
172
173
{ codeBlockProps && (
173
174
< span >
174
175
< a
175
- onClick = { canOpenInEditor ? this . openInEditor : null }
176
+ onClick = { canOpenInEditor ? this . editorHandler : null }
176
177
style = { canOpenInEditor ? codeAnchorStyle : null }
177
178
>
178
179
< CodeBlock { ...codeBlockProps } />
0 commit comments