File tree 1 file changed +7
-9
lines changed
client/modules/IDE/components 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -346,25 +346,23 @@ class Editor extends React.Component {
346
346
}
347
347
) ;
348
348
this . _cm . doc . setValue ( formatted ) ;
349
- return cursorOffset ;
349
+ if ( cursorOffset ) {
350
+ this . _cm . doc . setCursor ( this . _cm . doc . posFromIndex ( cursorOffset ) ) ;
351
+ }
350
352
} catch ( error ) {
351
- return null ;
353
+ console . error ( error ) ;
352
354
}
353
355
}
354
356
355
357
tidyCode ( ) {
356
358
const mode = this . _cm . getOption ( 'mode' ) ;
357
- let cursorOffset ;
358
359
if ( mode === 'javascript' ) {
359
- cursorOffset = this . prettierFormatWithCursor ( 'babel' , [ babelParser ] ) ;
360
+ this . prettierFormatWithCursor ( 'babel' , [ babelParser ] ) ;
360
361
} else if ( mode === 'css' ) {
361
- cursorOffset = this . prettierFormatWithCursor ( 'css' , [ cssParser ] ) ;
362
+ this . prettierFormatWithCursor ( 'css' , [ cssParser ] ) ;
362
363
} else if ( mode === 'htmlmixed' ) {
363
- cursorOffset = this . prettierFormatWithCursor ( 'html' , [ htmlParser ] ) ;
364
+ this . prettierFormatWithCursor ( 'html' , [ htmlParser ] ) ;
364
365
}
365
- this . _cm . focus ( ) ;
366
- if ( cursorOffset )
367
- this . _cm . doc . setCursor ( this . _cm . doc . posFromIndex ( cursorOffset ) ) ;
368
366
}
369
367
370
368
initializeDocuments ( files ) {
You can’t perform that action at this time.
0 commit comments