solive-core
Version:
Solidity Monaco Editor Core Library
40 lines • 1.56 kB
TypeScript
import React from 'react';
import monacoForTypes, { editor } from 'monaco-editor';
import { BaseMonacoEditor, ModelType } from '../../types/monaco';
import CodeParser from '../codeParser';
export interface IEditorInitState {
editor: editor.IStandaloneCodeEditor | undefined;
monaco: typeof monacoForTypes | undefined;
models: ModelType[] | undefined;
modelIndex: number | undefined;
codeParser: CodeParser;
codeParserInitLoading: boolean;
}
export interface IEditorReducerActionType {
type: 'updateEditor' | 'updateMonaco' | 'updateModels' | 'updateModelIndex' | 'setCodeParser' | 'updateCodeParserLoading' | 'cleanModels';
payload: Partial<IEditorInitState> & {
id?: string;
};
}
export type TEditorReducerAction = {
updateEditor: (e: BaseMonacoEditor) => void;
updateMonaco: (m: typeof monacoForTypes) => void;
updateModels: (m: ModelType[]) => void;
updateModelIndex: (m: number) => void;
setCodeParser: (m: any) => void;
updateCodeParserLoading: (m: boolean) => void;
cleanModels: () => void;
};
export type TEditorContext = {
state: IEditorInitState;
stateRef: React.MutableRefObject<IEditorInitState>;
dispatch: React.Dispatch<IEditorReducerActionType>;
actions: TEditorReducerAction;
id: string;
};
export declare function EditorProvider({ children, id }: {
children: React.ReactNode;
id: string;
}): JSX.Element;
export declare function useEditor(): TEditorContext;
//# sourceMappingURL=editorContext.d.ts.map