@@ -208,6 +208,10 @@ class Editor extends React.Component {
208
208
if ( / ^ [ a - z ] $ / i. test ( e . key ) && ( mode === 'css' || mode === 'javascript' ) ) {
209
209
this . showHint ( _cm ) ;
210
210
}
211
+ if ( e . key === 'Escape' ) {
212
+ e . preventDefault ( ) ;
213
+ this . _cm . getInputField ( ) . blur ( ) ;
214
+ }
211
215
} ) ;
212
216
213
217
this . _cm . getWrapperElement ( ) . style [
@@ -235,6 +239,16 @@ class Editor extends React.Component {
235
239
236
240
componentDidUpdate ( prevProps ) {
237
241
if ( this . props . file . id !== prevProps . file . id ) {
242
+ const fileMode = this . getFileMode ( this . props . file . name ) ;
243
+ if ( fileMode === 'javascript' ) {
244
+ // Define the new Emmet configuration based on the file mode
245
+ const emmetConfig = {
246
+ preview : [ 'html' ] ,
247
+ markTagPairs : false ,
248
+ autoRenameTags : true
249
+ } ;
250
+ this . _cm . setOption ( 'emmet' , emmetConfig ) ;
251
+ }
238
252
const oldDoc = this . _cm . swapDoc ( this . _docs [ this . props . file . id ] ) ;
239
253
this . _docs [ prevProps . file . id ] = oldDoc ;
240
254
this . _cm . focus ( ) ;
@@ -513,7 +527,7 @@ class Editor extends React.Component {
513
527
{ ( matches ) =>
514
528
matches ? (
515
529
< section className = { editorSectionClass } >
516
- < header className = "editor__header" >
530
+ < div className = "editor__header" >
517
531
< button
518
532
aria-label = { this . props . t ( 'Editor.OpenSketchARIA' ) }
519
533
className = "sidebar__contract"
@@ -538,7 +552,7 @@ class Editor extends React.Component {
538
552
</ span >
539
553
< Timer />
540
554
</ div >
541
- </ header >
555
+ </ div >
542
556
< article
543
557
ref = { ( element ) => {
544
558
this . codemirrorContainer = element ;
@@ -555,7 +569,7 @@ class Editor extends React.Component {
555
569
</ section >
556
570
) : (
557
571
< EditorContainer expanded = { this . props . isExpanded } >
558
- < header >
572
+ < >
559
573
< IconButton
560
574
onClick = { this . props . expandSidebar }
561
575
icon = { FolderIcon }
@@ -564,7 +578,7 @@ class Editor extends React.Component {
564
578
{ this . props . file . name }
565
579
< UnsavedChangesIndicator />
566
580
</ span >
567
- </ header >
581
+ </ >
568
582
< section >
569
583
< EditorHolder
570
584
ref = { ( element ) => {
0 commit comments