UNPKG

2.17 kBTypeScriptView Raw
1import * as monaco from "monaco-editor/esm/vs/editor/editor.api";
2import * as PropTypes from "prop-types";
3import * as React from "react";
4import { MonacoEditorProps } from "./types";
5import { noop } from "./utils";
6declare class MonacoEditor extends React.Component<MonacoEditorProps> {
7 static propTypes: {
8 width: PropTypes.Requireable<string | number>;
9 height: PropTypes.Requireable<string | number>;
10 value: PropTypes.Requireable<string>;
11 defaultValue: PropTypes.Requireable<string>;
12 language: PropTypes.Requireable<string>;
13 theme: PropTypes.Requireable<string>;
14 options: PropTypes.Requireable<object>;
15 overrideServices: PropTypes.Requireable<object>;
16 editorWillMount: PropTypes.Requireable<(...args: any[]) => any>;
17 editorDidMount: PropTypes.Requireable<(...args: any[]) => any>;
18 editorWillUnmount: PropTypes.Requireable<(...args: any[]) => any>;
19 onChange: PropTypes.Requireable<(...args: any[]) => any>;
20 className: PropTypes.Requireable<string>;
21 };
22 static defaultProps: {
23 width: string;
24 height: string;
25 value: any;
26 defaultValue: string;
27 language: string;
28 theme: any;
29 options: {};
30 overrideServices: {};
31 editorWillMount: typeof noop;
32 editorDidMount: typeof noop;
33 editorWillUnmount: typeof noop;
34 onChange: typeof noop;
35 className: any;
36 };
37 editor?: monaco.editor.IStandaloneCodeEditor;
38 private containerElement?;
39 private _subscription;
40 private __prevent_trigger_change_event?;
41 constructor(props: MonacoEditorProps);
42 componentDidMount(): void;
43 componentDidUpdate(prevProps: MonacoEditorProps): void;
44 componentWillUnmount(): void;
45 assignRef: (component: HTMLDivElement) => void;
46 destroyMonaco(): void;
47 initMonaco(): void;
48 editorWillMount(): monaco.editor.IStandaloneEditorConstructionOptions;
49 editorDidMount(editor: monaco.editor.IStandaloneCodeEditor): void;
50 editorWillUnmount(editor: monaco.editor.IStandaloneCodeEditor): void;
51 render(): JSX.Element;
52}
53export default MonacoEditor;