UNPKG

@lyove/monaco-editor-react

Version:

🌴 Monaco Code Editor for React, without need of configuration files or plugins

81 lines (78 loc) • 2.51 kB
import * as MonacoEditor from 'monaco-editor'; import React from 'react'; export interface EditorProps { width?: number; height?: number; value: string; language: string; theme?: string; bordered?: boolean; options?: MonacoEditor.editor.IEditorOptions; supportFullScreen?: boolean; className?: string; monacoWillMount?: (monaco: any) => void; editorDidMount?: (editor: MonacoEditor.editor.IStandaloneCodeEditor | undefined, monaco: any) => void; onChange?: (value: string | null) => void; monacoPath?: string; } export interface EditorState { ready: boolean; isFullScreen: boolean; } declare class Editor extends React.Component<EditorProps, EditorState> { private container; monaco: any; editor?: MonacoEditor.editor.IStandaloneCodeEditor; private originalLayout; static displayName: string; constructor(props: EditorProps); componentDidMount(): void; componentDidUpdate(prevProps: EditorProps, preState: EditorState): void; componentWillUnmount(): void; bindRef(node: HTMLDivElement | null): void; createEditor(): void; resizeEditorHeight: () => void; handleFullScreen: (sizeMode: string) => void; render(): JSX.Element; } export interface DiffProps { width?: number; height?: number; className?: string; bordered?: boolean; original: string; modified: string; originalLanguage?: string; modifiedLanguage?: string; language: string; theme?: string; options?: MonacoEditor.editor.IDiffEditorOptions; monacoWillMount?: (monaco: any) => void; editorDidMount?: (original: MonacoEditor.editor.ITextModel, modified: MonacoEditor.editor.ITextModel, editor: MonacoEditor.editor.IStandaloneDiffEditor, monaco: any) => void; onChange?: (value: string) => void; monacoPath?: string; } export interface DiffState { ready: boolean; } declare class DiffEditor extends React.Component<DiffProps, DiffState> { monaco: any; editor: any; container: HTMLDivElement | null; static displayName: string; constructor(props: DiffProps); componentDidMount(): void; componentDidUpdate(prevProps: DiffProps, preState: DiffState): void; componentWillUnmount(): void; bindRef(node: HTMLDivElement | null): void; createEditor(): void; render(): JSX.Element; } export type themeType = Array<"active4d" | "clouds" | "chrome" | "monokai" | "solarized-dark" | "solarized-light">; export declare const themeNames: themeType; export type MonacoEditorProps = EditorProps; export type MonacoDiffEditorProps = DiffProps; export { DiffEditor as MonacoDiffEditor, Editor as default, };