UNPKG

@uiw/react-markdown-editor

Version:

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

49 lines (48 loc) 1.67 kB
import { ReactCodeMirrorRef } from '@uiw/react-codemirror'; import { bold } from './bold'; import { code, codeBlock } from './code'; import { italic } from './italic'; import { header } from './header'; import { strike } from './strike'; import { underline } from './underline'; import { olist } from './olist'; import { ulist } from './ulist'; import { quote } from './quote'; import { link } from './link'; import { todo } from './todo'; import { image } from './image'; import { redo } from './redo'; import { undo } from './undo'; import { fullscreen } from './fullscreen'; import { preview } from './preview'; import { IMarkdownEditor, ToolBarProps } from '..'; export type ButtonHandle = (command: ICommand, props: IMarkdownEditor, options: ToolBarProps) => JSX.Element; export type ICommand = { icon?: React.ReactElement; name?: string; keyCommand?: string; button?: ButtonHandle | React.ButtonHTMLAttributes<HTMLButtonElement>; execute?: (editor: ReactCodeMirrorRef) => void; }; export declare const defaultCommands: { undo: ICommand; redo: ICommand; bold: ICommand; italic: ICommand; header: ICommand; strike: ICommand; underline: ICommand; quote: ICommand; olist: ICommand; ulist: ICommand; todo: ICommand; link: ICommand; image: ICommand; code: ICommand; codeBlock: ICommand; fullscreen: ICommand; preview: ICommand; }; export declare const getCommands: () => ICommand[]; export declare const getModeCommands: () => ICommand[]; export { bold, code, codeBlock, italic, header, strike, underline, olist, ulist, quote, link, todo, image, redo, undo, fullscreen, preview, };