File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
client/modules/IDE/components Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -269,15 +269,19 @@ class Editor extends React.Component {
269269 indent_size : INDENTATION_AMOUNT ,
270270 indent_with_tabs : IS_TAB_INDENT
271271 } ;
272-
273272 const mode = this . _cm . getOption ( 'mode' ) ;
273+ const currentPosition = this . _cm . doc . getCursor ( ) ;
274274 if ( mode === 'javascript' ) {
275275 this . _cm . doc . setValue ( beautifyJS ( this . _cm . doc . getValue ( ) , beautifyOptions ) ) ;
276276 } else if ( mode === 'css' ) {
277277 this . _cm . doc . setValue ( beautifyCSS ( this . _cm . doc . getValue ( ) , beautifyOptions ) ) ;
278278 } else if ( mode === 'htmlmixed' ) {
279279 this . _cm . doc . setValue ( beautifyHTML ( this . _cm . doc . getValue ( ) , beautifyOptions ) ) ;
280280 }
281+ setTimeout ( ( ) => {
282+ this . _cm . focus ( ) ;
283+ this . _cm . doc . setCursor ( { line : currentPosition . line , ch : currentPosition . ch + INDENTATION_AMOUNT } ) ;
284+ } , 0 ) ;
281285 }
282286
283287 initializeDocuments ( files ) {
You can’t perform that action at this time.
0 commit comments