UNPKG

@uiw/react-md-editor

Version:

A markdown editor with preview, implemented with React.js and TypeScript.

28 lines (27 loc) 1.36 kB
import React from 'react'; import { ContextStore, ExecuteCommandState } from '../../Context'; import { TextAreaProps } from './Textarea'; import { IProps } from '../../Editor'; import { TextAreaCommandOrchestrator, ICommand } from '../../commands'; import './index.less'; declare type RenderTextareaHandle = { dispatch: ContextStore['dispatch']; onChange?: TextAreaProps['onChange']; useContext?: { commands: ContextStore['commands']; extraCommands: ContextStore['extraCommands']; commandOrchestrator?: TextAreaCommandOrchestrator; }; shortcuts?: (e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands: ICommand[], commandOrchestrator?: TextAreaCommandOrchestrator, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState) => void; }; export interface ITextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onScroll'>, IProps { value?: string; onScroll?: (e: React.UIEvent<HTMLDivElement>) => void; renderTextarea?: (props: React.TextareaHTMLAttributes<HTMLTextAreaElement> | React.HTMLAttributes<HTMLDivElement>, opts: RenderTextareaHandle) => JSX.Element; } export declare type TextAreaRef = { text?: HTMLTextAreaElement; warp?: HTMLDivElement; }; export default function TextArea(props: ITextAreaProps): JSX.Element; export {};