import { CSSProperties } from 'react'; import { Monaco } from '@monaco-editor/loader'; import type { editor as oEditor } from 'monaco-editor'; /** * @see https://microsoft.github.io/monaco-editor/api/index.html */ export type IEditorInstance = oEditor.IStandaloneCodeEditor | oEditor.IStandaloneDiffEditor; export type EditorEnhancer = (monaco: Monaco, editorIns: IEditorInstance) => any; export interface IGeneralManacoEditorProps { /** [Monaco editor options](https://microsoft.github.io/monaco-editor/) */ options?: Record; /** callback after monaco's loaded and after editor's loaded */ editorDidMount?: (monaco: Monaco, editor: IEditorInstance) => void; /** callback after monaco's loaded and before editor's loaded */ editorWillMount?: (monaco: Monaco) => void; /** path of the current model, useful when creating a multi-model editor */ path?: string; /** whether to save the models' view states between model changes or not */ saveViewState?: boolean; /** language of the editor @see https://microsoft.github.io/monaco-editor/ for available languages */ language?: string; /** theme of the editor, "light" | "vs-dark" */ theme?: string; /** [config passing to require](https://github.com/suren-atoyan/monaco-react#loader-config), can be used to upgrade monaco-editor */ requireConfig?: Record; /** value, controlled */ value?: string; /** defaultValue for creating model, uncontrolled */ defaultValue?: string; /** className of wrapper */ className?: string; /** width of wrapper */ width?: number | string; /** height of wrapper */ height?: number | string; /** whether to enable outline of wrapper or not */ enableOutline?: boolean; /** style of wrapper */ style?: CSSProperties; overrideServices?: oEditor.IEditorOverrideServices; enhancers?: EditorEnhancer[]; } export interface ISingleMonacoEditorProps extends IGeneralManacoEditorProps { onChange?: (input: string, event: any) => void; supportFullScreen?: boolean; } export interface IDiffMonacoEditorProps extends IGeneralManacoEditorProps { original?: string; } export declare const WORD_EDITOR_INITIALIZING: string; export declare const INITIAL_OPTIONS: oEditor.IStandaloneEditorConstructionOptions; export declare const useEditor: (type: 'single' | 'diff', props: IGeneralManacoEditorProps) => { readonly isEditorReady: boolean; readonly focused: boolean; readonly loading: boolean; readonly containerRef: import("react").MutableRefObject; readonly monacoRef: import("react").MutableRefObject; readonly editorRef: React.MutableRefObject; readonly valueRef: import("react").MutableRefObject; };