import React, { useState } from "react"; import Editor from "@monaco-editor/react"; export const MonacoEditor = ({ value, editorRef, language, onChange, minimap = true, className, }: { value: string; onChange?: (value: string) => void; editorRef: any; language: string; minimap?: boolean; className?: string; }) => { const [isEditorReady, setIsEditorReady] = useState(false); const onEditorDidMount = (editor: any, monaco: any) => { editorRef.current = editor; setIsEditorReady(true); }; return (
{ if (onChange && value) { onChange(value); } }} onMount={onEditorDidMount} theme="vs-dark" options={{ wordWrap: "on", wrappingIndent: "indent", wrappingStrategy: "advanced", minimap: { enabled: minimap, }, }} />
); };