import React from 'react'; import Editor from '@monaco-editor/react'; import { Card, CardContent } from '@/components/ui/card'; import { Alert, AlertDescription } from '@/components/ui/alert'; export const StandardEditor = ({ content, onChange, readOnly = false, language = 'xml', validationError = null, autoScroll = false, }) => { const editorRef = React.useRef(null); const scrollToBottom = () => { if (editorRef.current && autoScroll) { const model = editorRef.current.getModel(); const lineCount = model.getLineCount(); editorRef.current.revealLine(lineCount, monaco.editor.ScrollType.Smooth); } }; const handleEditorDidMount = (editor) => { editorRef.current = editor; setTimeout(() => { scrollToBottom(); }, 10); }; React.useEffect(() => { scrollToBottom(); }, [content, autoScroll]); return ( {validationError && ( {validationError} )} ); };