forked from elastic/eui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_editor.js
More file actions
39 lines (34 loc) · 840 Bytes
/
code_editor.js
File metadata and controls
39 lines (34 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React, { Component } from 'react';
import 'brace/theme/github';
import 'brace/mode/javascript';
import 'brace/snippets/javascript';
import 'brace/ext/language_tools';
import {
EuiCodeEditor,
} from '../../../../src/components';
export default class extends Component {
state = {
value: ''
};
onChange = (value) => {
this.setState({ value });
};
render() {
return (
<EuiCodeEditor
mode="javascript"
theme="github"
width="100%"
value={this.state.value}
onChange={this.onChange}
setOptions={{
fontSize: '14px',
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true,
}}
onBlur={() => { console.log('blur'); }} // eslint-disable-line no-console
/>
);
}
}