import { Component } from 'react';
import CM, { Editor, EditorChange, EditorConfiguration, ModeSpec, ModeSpecOptions, ScrollInfo } from 'codemirror';
import './CodeEditor.less';
type ExtendedEditorConfiguration = EditorConfiguration & {
    enterMode?: string;
    tabMode?: string;
};
export interface CodeEditorProps {
    /**
     * The mode to use. When not given, this will default to the first mode that was loaded.
     * @since 0.0.61
     */
    mode?: string | ModeSpec<ModeSpecOptions> | null;
    /**
     * CodeEditor can detect mode by file name. Will be ignored if you set mode property.
     * @since 0.0.61
     */
    fileName?: string;
    /**
     * Content of the `CodeEditor`.
     * @since 0.0.61
     */
    children?: string;
    /**
     * Set read only.
     * @since 0.0.61
     */
    readOnly?: boolean | string;
    /**
     * Set autofocus.
     * @since 0.0.61
     */
    autofocus?: boolean;
    /**
     * onInit event handler.
     * @since 0.0.61
     */
    onInit?: (el: HTMLElement) => void;
    /**
     * onChange event handler.
     * @since 0.0.61
     */
    onChange?: (content: string) => void;
    /**
     * onSave event handler.
     * @since 0.0.61
     */
    onSave?: () => void;
    /**
     * See all supported options in [CodeMirror](https://codemirror.net/doc/manual.html#config) documentation.
     * @since 0.0.61
     */
    options?: ExtendedEditorConfiguration;
    /**
     * Set scroll position.
     * @since 1.12.4
     */
    scrollPosition?: {
        top: number;
        left: number;
    };
    /**
     * onScroll event handler.
     * @since 1.12.4
     */
    onScroll?: (scrollInfo: ScrollInfo) => void;
    /**
     * @ignore
     */
    className?: string;
    /**
     * @ignore
     */
    baseClassName?: string;
}
type CodeEditorState = {
    lineSeparator: string;
    content?: string;
    options: ExtendedEditorConfiguration;
};
/**
 * `CodeEditor` component is used for editing text as code with proper color highlighting according to selected programming language.
 * @since 0.0.61
 */
declare class CodeEditor extends Component<CodeEditorProps, CodeEditorState> {
    static defaultProps: {
        mode: string;
        fileName: string;
        children: string;
        readOnly: boolean;
        autofocus: boolean;
        onInit: null;
        onChange: null;
        onSave: null;
        options: null;
        className: null;
        baseClassName: string;
        scrollPosition: undefined;
        onScroll: undefined;
    };
    state: CodeEditorState;
    static getDerivedStateFromProps({ readOnly, autofocus, options }: CodeEditorProps, state: CodeEditorState): {
        options: {
            autofocus: boolean | undefined;
            readOnly: string | boolean | undefined;
            value?: string | CM.Doc | undefined;
            mode?: string | CM.ModeSpec<CM.ModeSpecOptions> | undefined;
            lineSeparator?: string | null | undefined;
            theme?: string | undefined;
            indentUnit?: number | undefined;
            smartIndent?: boolean | undefined;
            tabSize?: number | undefined;
            indentWithTabs?: boolean | undefined;
            electricChars?: boolean | undefined;
            specialChars?: RegExp | undefined;
            specialCharPlaceholder?: ((char: string) => HTMLElement) | undefined;
            direction?: "ltr" | "rtl" | undefined;
            rtlMoveVisually?: boolean | undefined;
            keyMap?: string | undefined;
            extraKeys?: string | CM.KeyMap | undefined;
            configureMouse?: ((cm: CM.Editor, repeat: "double" | "single" | "triple", event: Event) => CM.MouseSelectionConfiguration) | undefined;
            lineWrapping?: boolean | undefined;
            lineNumbers?: boolean | undefined;
            firstLineNumber?: number | undefined;
            lineNumberFormatter?: ((line: number) => string) | undefined;
            gutters?: (string | {
                className: string;
                style?: string | undefined;
            })[] | undefined;
            fixedGutter?: boolean | undefined;
            scrollbarStyle?: keyof CM.ScrollbarModels | undefined;
            coverGutterNextToScrollbar?: boolean | undefined;
            inputStyle?: CM.InputStyle | undefined;
            screenReaderLabel?: string | undefined;
            showCursorWhenSelecting?: boolean | undefined;
            lineWiseCopyCut?: boolean | undefined;
            pasteLinesPerSelection?: boolean | undefined;
            selectionsMayTouch?: boolean | undefined;
            undoDepth?: number | undefined;
            historyEventDelay?: number | undefined;
            tabindex?: number | undefined;
            phrases?: {
                [s: string]: unknown;
            } | undefined;
            dragDrop?: boolean | undefined;
            allowDropFileTypes?: string[] | null | undefined;
            onDragEvent?: ((instance: CM.Editor, event: DragEvent) => boolean) | undefined;
            onKeyEvent?: ((instance: CM.Editor, event: KeyboardEvent) => boolean) | undefined;
            cursorBlinkRate?: number | undefined;
            cursorScrollMargin?: number | undefined;
            cursorHeight?: number | undefined;
            resetSelectionOnContextMenu?: boolean | undefined;
            workTime?: number | undefined;
            workDelay?: number | undefined;
            pollInterval?: number | undefined;
            flattenSpans?: boolean | undefined;
            addModeClass?: boolean | undefined;
            maxHighlightLength?: number | undefined;
            viewportMargin?: number | undefined;
            spellcheck?: boolean | undefined;
            autocorrect?: boolean | undefined;
            autocapitalize?: boolean | undefined;
            matchBrackets?: boolean | CM.MatchBrackets | undefined;
            matchTags?: boolean | CM.MatchTags | undefined;
            search?: {
                bottom: boolean;
            } | undefined;
            autoRefresh?: boolean | {
                delay: number;
            } | undefined;
            enterMode?: string | undefined;
            tabMode?: string | undefined;
        };
    };
    componentDidMount(): void;
    componentDidUpdate(prevProps: CodeEditorProps): void;
    componentWillUnmount(): void;
    private readonly textareaNode;
    private CodeMirror?;
    private codeMirror?;
    handleScroll: () => void;
    findModeByFileName(fileName: string): string | null;
    updateMode({ mode, fileName }: Pick<CodeEditorProps, 'mode' | 'fileName'>): void;
    getLineSeparator(content?: string): string;
    handleChange: (doc: Editor, changes: EditorChange) => void;
    render(): import("react/jsx-runtime").JSX.Element;
}
export default CodeEditor;
