import * as React from "react"; import { IElement } from "./basic"; type Props = IElement & { code?: string; onChanged?: (code: string) => void; }; export class CodeEditor extends React.Component { readonly editor = React.createRef(); constructor(props: Props) { super(props); } get code() { return this.editor.current!.value; } render() { return (
); } notifyChanged = () => { if (!this.editor.current) { return; } this.props.onChanged?.(this.editor.current.value); }; }