File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 11// CodeMirror
2- import 'codemirror/mode/xml/xml ' ;
2+ import '../../utils/codemirror-jsx ' ;
33import 'codemirror/lib/codemirror.css' ;
44
55import _ from 'lodash' ;
@@ -20,7 +20,7 @@ export default class Editor extends Component {
2020 onChange : PropTypes . func
2121 }
2222 static codemirrorOptions = {
23- mode : 'xml ' ,
23+ mode : 'jsx ' ,
2424 lineNumbers : false ,
2525 lineWrapping : true ,
2626 smartIndent : false ,
Original file line number Diff line number Diff line change 1+ import CodeMirror from 'codemirror/lib/codemirror' ;
2+ import 'codemirror/mode/htmlmixed/htmlmixed' ;
3+ import 'codemirror/addon/mode/multiplex' ;
4+
5+ // TODO: Real JSX syntax highlighting
6+ // https://github.com/codemirror/CodeMirror/issues/3122
7+
8+ CodeMirror . defineMode ( 'jsx' , ( config ) => {
9+ return CodeMirror . multiplexingMode ( CodeMirror . getMode ( config , 'htmlmixed' ) , {
10+ open : '{' ,
11+ close : '}' ,
12+ delimStyle : 'delimit' ,
13+ mode : CodeMirror . getMode ( config , 'javascript' )
14+ } ) ;
15+ } ) ;
You can’t perform that action at this time.
0 commit comments