@@ -521,27 +521,20 @@ export default class CodeEditor extends React.Component<Props, State> {
521521 const kind = title . match ( / \. ( [ ^ . ] * ) $ / ) ;
522522
523523 if ( kind ) {
524- if ( kind [ 1 ] === 'css' ) {
525- return 'css' ;
526- }
527- if ( kind [ 1 ] === 'scss' ) {
528- return 'scss' ;
529- } else if ( kind [ 1 ] === 'html' ) {
530- return 'html' ;
531- } else if ( kind [ 1 ] === 'vue' ) {
524+ if ( kind [ 1 ] === 'css' ) return 'css' ;
525+ if ( kind [ 1 ] === 'scss' ) return 'scss' ;
526+ if ( kind [ 1 ] === 'json' ) return 'json' ;
527+ if ( kind [ 1 ] === 'html' ) return 'html' ;
528+ if ( kind [ 1 ] === 'vue' ) {
532529 if ( ! this . monaco . languages . getLanguages ( ) . find ( l => l . id === 'vue' ) ) {
533530 await requireAMDModule ( [ 'vs/language/vue/monaco.contribution' ] ) ;
534531 }
535532 return 'vue ';
536- } else if ( kind [ 1 ] === 'less' ) {
537- return 'less' ;
538- } else if ( kind [ 1 ] === 'md' ) {
539- return 'markdown' ;
540- } else if ( / j s x ? $ / . test ( kind [ 1 ] ) ) {
541- return 'javascript' ;
542- } else if ( / t s x ? $ / . test ( kind [ 1 ] ) ) {
543- return 'typescript' ;
544533 }
534+ if ( kind [ 1 ] === 'less' ) return 'less ';
535+ if ( kind [ 1 ] === 'md' ) return 'markdown ';
536+ if ( / j s x ? $ / . test ( kind [ 1 ] ) ) return 'javascript ';
537+ if ( / t s x ? $ / . test ( kind [ 1 ] ) ) return 'typescript ';
545538 }
546539
547540 return 'typescript ';
@@ -882,7 +875,12 @@ export default class CodeEditor extends React.Component<Props, State> {
882875 const code = this.getCode();
883876 const mode = await this.getMode(title);
884877
885- if (mode === 'javascript' || mode === 'typescript' || mode === 'css') {
878+ if (
879+ mode === 'javascript' ||
880+ mode === 'typescript' ||
881+ mode === 'json' ||
882+ mode === 'css'
883+ ) {
886884 try {
887885 const prettify = await import ( /* webpackChunkName: 'prettier' */ 'app/utils/codemirror/prettify' ) ;
888886 const newCode = await prettify . default (
0 commit comments