File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
docs/client/components/PlaygroundPage/PlaygroundWithPreview Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import Editor from 'codemirror' ;
3
+ import 'codemirror/lib/codemirror.css' ;
4
+ import 'codemirror/mode/javascript/javascript' ;
5
+
6
+ import styles from './styles.scss' ;
7
+
8
+ import './editor.css' ;
9
+
10
+ class Playground extends React . Component {
11
+ constructor ( props ) {
12
+ super ( props ) ;
13
+
14
+ }
15
+
16
+ componentDidMount ( ) {
17
+ this . editor = Editor . fromTextArea ( this . refs . editor , {
18
+ mode : 'javascript' ,
19
+ lineNumbers : false ,
20
+ smartIndent : false ,
21
+ tabSize : 2 ,
22
+ matchBrackets : true ,
23
+ theme : 'custom' ,
24
+ readOnly : false ,
25
+ } ) ;
26
+ }
27
+
28
+ render ( ) {
29
+ return (
30
+ < div className = { styles . playground } >
31
+ < textarea
32
+ ref = "editor"
33
+ defaultValue = { this . props . code }
34
+ />
35
+ </ div >
36
+ ) ;
37
+ }
38
+ }
39
+
40
+ export default Playground ;
You can’t perform that action at this time.
0 commit comments