mirror of
https://github.com/microsoft/autogen.git
synced 2025-08-06 15:51:58 +00:00

* v1 progress on drag_drop * add v1 for node deletions * major refactor, add sidebar to teams and session playground * format updates * formatting updates * update formatting * formatting and other checks * add mangentic one deps * general refactor, fix new team creation bug etc... * minor bugfix * update uv lock --------- Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
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 (
|
|
<div id="monaco-editor" className={`h-full rounded ${className}`}>
|
|
<Editor
|
|
height="100%"
|
|
className="h-full rounded"
|
|
defaultLanguage={language}
|
|
defaultValue={value}
|
|
value={value}
|
|
onChange={(value: string | undefined) => {
|
|
if (onChange && value) {
|
|
onChange(value);
|
|
}
|
|
}}
|
|
onMount={onEditorDidMount}
|
|
theme="vs-dark"
|
|
options={{
|
|
wordWrap: "on",
|
|
wrappingIndent: "indent",
|
|
wrappingStrategy: "advanced",
|
|
minimap: {
|
|
enabled: minimap,
|
|
},
|
|
}}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|