forked from forthfate/openorbit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-editor.tsx
More file actions
18 lines (17 loc) · 771 Bytes
/
Copy pathpython-editor.tsx
File metadata and controls
18 lines (17 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import CodeMirror from '@uiw/react-codemirror'
import { python } from '@codemirror/lang-python'
import { oneDark } from '@codemirror/theme-one-dark'
import { EditorView } from '@codemirror/view'
export function PythonEditor({value,onChange,ariaLabel}:{value:string;onChange:(value:string)=>void;ariaLabel:string}){
return <CodeMirror
aria-label={ariaLabel}
value={value}
height="min(56vh, 620px)"
theme={oneDark}
// Keep long comments, URLs, and embedded data inside the modal rather than
// letting one line widen the editor and push the save action off screen.
extensions={[python(),EditorView.lineWrapping]}
onChange={onChange}
basicSetup={{lineNumbers:true,highlightActiveLine:true,bracketMatching:true,foldGutter:true}}
/>
}