@@ -87,7 +87,6 @@ class Editor extends React.Component {
87
87
this . findPrev = this . findPrev . bind ( this ) ;
88
88
this . showReplace = this . showReplace . bind ( this ) ;
89
89
this . getContent = this . getContent . bind ( this ) ;
90
- this . handleKey = this . handleKey . bind ( this ) ;
91
90
}
92
91
93
92
componentDidMount ( ) {
@@ -155,22 +154,15 @@ class Editor extends React.Component {
155
154
}
156
155
} , 1000 ) ) ;
157
156
158
- this . map = { } ;
159
-
160
157
this . _cm . on ( 'keyup' , ( _cm , e ) => {
161
158
const temp = this . props . t ( 'Editor.KeyUpLineNumber' , { lineNumber : parseInt ( ( this . _cm . getCursor ( ) . line ) + 1 , 10 ) } ) ;
162
159
document . getElementById ( 'current-line' ) . innerHTML = temp ;
163
- this . handleKey ( this . map , e ) ;
164
160
} ) ;
165
161
166
162
this . _cm . on ( 'keydown' , ( _cm , e ) => {
167
- this . handleKey ( this . map , e ) ;
168
- // 91 === Cmd
169
- // 16 === Shift
170
163
// 70 === f
171
- // 17 === Ctrl
172
- if ( ( ( metaKey === 'Cmd' && this . map [ 91 ] ) || ( metaKey === 'Ctrl' && this . map [ 17 ] ) ) && this . map [ 16 ] && this . map [ 70 ] ) {
173
- e . preventDefault ( ) ; // prevent browser's default behaviour
164
+ if ( ( e . metaKey || e . ctrlKey ) && e . shiftKey && e . keyCode === 70 ) {
165
+ e . preventDefault ( ) ;
174
166
this . tidyCode ( ) ;
175
167
}
176
168
} ) ;
@@ -335,10 +327,6 @@ class Editor extends React.Component {
335
327
}
336
328
}
337
329
338
- handleKey ( map , e ) { // update the 'keydown 'state of each key
339
- map [ e . keyCode ] = e . type === 'keydown' ;
340
- }
341
-
342
330
render ( ) {
343
331
const editorSectionClass = classNames ( {
344
332
'editor' : true ,
0 commit comments