2020-10-27 19:22:41 +00:00
|
|
|
// import React from 'react';
|
|
|
|
// import MonacoEditor from 'react-monaco-editor';
|
2020-10-26 08:54:30 +00:00
|
|
|
|
2020-10-27 19:22:41 +00:00
|
|
|
// export interface CodeEditorProps {
|
|
|
|
// code: string
|
|
|
|
// }
|
2020-10-26 08:54:30 +00:00
|
|
|
|
2020-10-27 19:22:41 +00:00
|
|
|
// export interface CodeEditorState {
|
|
|
|
// code: string
|
|
|
|
// }
|
2020-10-26 08:54:30 +00:00
|
|
|
|
2020-10-27 19:22:41 +00:00
|
|
|
// class CodeEditor extends React.Component<CodeEditorProps, CodeEditorState> {
|
|
|
|
// constructor(props) {
|
|
|
|
// super(props);
|
|
|
|
// this.state = {
|
|
|
|
// code: '// type your code...',
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// editorDidMount(editor, monaco) {
|
|
|
|
// console.log('editorDidMount', editor);
|
|
|
|
// editor.focus();
|
|
|
|
// }
|
|
|
|
// onChange(newValue, e) {
|
|
|
|
// console.log('onChange', newValue, e);
|
|
|
|
// }
|
|
|
|
// render() {
|
|
|
|
// const code = this.state.code;
|
|
|
|
// const options = {
|
|
|
|
// selectOnLineNumbers: true
|
|
|
|
// };
|
2020-10-26 08:54:30 +00:00
|
|
|
|
2020-10-27 19:22:41 +00:00
|
|
|
// const _this = this;
|
|
|
|
// return (
|
|
|
|
// <MonacoEditor
|
|
|
|
// width="800"
|
|
|
|
// height="600"
|
|
|
|
// language="javascript"
|
|
|
|
// theme="vs-dark"
|
|
|
|
// value={code}
|
|
|
|
// options={options}
|
|
|
|
// onChange={(...args) => _this.onChange(...args)}
|
|
|
|
// editorDidMount={(...args) => _this.editorDidMount(...args)}
|
|
|
|
// />
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
2020-10-26 08:54:30 +00:00
|
|
|
|
2020-10-27 19:22:41 +00:00
|
|
|
// export default CodeEditor;
|