1
- import { React , useState , useEffect } from "react" ;
1
+ import React , { useState , useEffect } from "react" ;
2
2
3
3
import AceEditor from "react-ace" ;
4
4
import "ace-builds/src-noconflict/theme-github" ;
@@ -15,13 +15,7 @@ const ajv = new Ajv({ allErrors: true });
15
15
import Schema from "../../../static/schema/schema.v2.json" ;
16
16
17
17
const validate = ajv . compile ( Schema . definitions . schema ) ;
18
-
19
- export default function YamlEditor ( ) {
20
- const [ value , setValue ] = useState ( "" ) ;
21
- const [ annotations , setAnnotations ] = useState ( [ ] ) ;
22
-
23
- useEffect ( ( ) => {
24
- const initialValue = `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
18
+ const initialValue = `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
25
19
language: "en-US"
26
20
early_access: false
27
21
reviews:
38
32
auto_reply: true
39
33
40
34
` ;
35
+ export default function YamlEditor ( ) {
36
+ const [ value , setValue ] = useState ( initialValue ) ;
37
+ const [ annotations , setAnnotations ] = useState ( [ ] ) ;
38
+
39
+ useEffect ( ( ) => {
41
40
setValue ( initialValue ) ;
42
41
validateAndSetAnnotations ( initialValue ) ;
43
42
} , [ ] ) ;
@@ -135,21 +134,24 @@ chat:
135
134
}
136
135
137
136
return (
138
- < AceEditor
139
- mode = "yaml"
140
- theme = "github"
141
- onChange = { onChange }
142
- value = { value }
143
- name = "yaml-editor"
144
- editorProps = { { $blockScrolling : true } }
145
- setOptions = { {
146
- useWorker : false ,
147
- showPrintMargin : false ,
148
- showGutter : true ,
149
- } }
150
- annotations = { annotations }
151
- width = "100%"
152
- height = "400px"
153
- />
137
+ < div className = "m4" >
138
+ < AceEditor
139
+ mode = "yaml"
140
+ theme = "github"
141
+ onChange = { onChange }
142
+ value = { value }
143
+ name = "yaml-editor"
144
+ editorProps = { { $blockScrolling : true } }
145
+ setOptions = { {
146
+ useWorker : false ,
147
+ showPrintMargin : false ,
148
+ showGutter : true ,
149
+ } }
150
+ annotations = { annotations }
151
+ width = "100%"
152
+ height = "400px"
153
+ />
154
+ < br />
155
+ </ div >
154
156
) ;
155
157
}
0 commit comments