sql-editor-react
Version:
基于monaco-editor react 实现的sql编辑器,支持语法高亮、 关联数据库,表名 关键字 功能
31 lines • 1.71 kB
TypeScript
import { ReactNode } from 'react';
import { MonacoEditorBaseProps } from '../types';
import * as monacoEditor from "monaco-editor/esm/vs/editor/editor.api";
export type IMonacoEditor = typeof monacoEditor;
export type EditorConstructionOptions = NonNullable<Parameters<typeof monacoEditor.editor.create>[1]>;
export type EditorWillMount = (monaco: typeof monacoEditor) => void | EditorConstructionOptions;
export type EditorDidMount = (editor: monacoEditor.editor.IStandaloneCodeEditor, monaco: typeof monacoEditor) => void;
export type EditorWillUnmount = (editor: monacoEditor.editor.IStandaloneCodeEditor, monaco: typeof monacoEditor) => void | EditorConstructionOptions;
export type ChangeHandler = (value: string, event: monacoEditor.editor.IModelContentChangedEvent) => void;
export interface RefEditorInstance {
container: HTMLDivElement | null;
editor?: monacoEditor.editor.IStandaloneCodeEditor;
monaco: IMonacoEditor;
format: () => void;
setReadOnly: (value: boolean) => void;
}
export interface MonacoEditorProps extends MonacoEditorBaseProps {
value?: string;
dataBase?: Record<string, string[]>;
overrideServices?: monacoEditor.editor.IEditorOverrideServices;
autoComplete?: (model: monacoEditor.editor.ITextModel, position: monacoEditor.Position) => monacoEditor.languages.CompletionItem[];
options?: monacoEditor.editor.IStandaloneEditorConstructionOptions;
editorWillMount?: EditorWillMount;
editorWillUnmount?: EditorWillUnmount;
editorDidMount?: EditorDidMount;
onChange?: ChangeHandler;
children?: ReactNode;
}
export type Monaco = typeof monacoEditor;
export type Theme = "vs-dark" | "light";
//# sourceMappingURL=types.d.ts.map