2022-03-16 23:24:27 +05:30
|
|
|
import MEditor from '@monaco-editor/react';
|
|
|
|
|
import React from 'react';
|
2021-11-22 11:49:09 +05:30
|
|
|
|
2022-03-22 12:10:31 +05:30
|
|
|
function Editor({ value }: EditorProps): JSX.Element {
|
2022-03-16 23:24:27 +05:30
|
|
|
return (
|
|
|
|
|
<MEditor
|
|
|
|
|
theme="vs-dark"
|
|
|
|
|
defaultLanguage="yaml"
|
|
|
|
|
value={value.current}
|
|
|
|
|
options={{ fontSize: 16, automaticLayout: true }}
|
2022-03-22 12:10:31 +05:30
|
|
|
height="40vh"
|
2022-03-23 19:03:05 +05:30
|
|
|
onChange={(newValue): void => {
|
|
|
|
|
if (value.current && newValue) {
|
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
|
value.current = newValue;
|
|
|
|
|
}
|
|
|
|
|
}}
|
2022-03-16 23:24:27 +05:30
|
|
|
/>
|
|
|
|
|
);
|
2022-03-22 12:10:31 +05:30
|
|
|
}
|
2021-11-22 11:49:09 +05:30
|
|
|
|
|
|
|
|
interface EditorProps {
|
|
|
|
|
value: React.MutableRefObject<string>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Editor;
|