UNPKG

burdy

Version:

Open Source Headless Platform

34 lines (33 loc) 1.38 kB
import React from 'react'; import { DraftHandleValue, Editor, EditorProps, EditorState } from 'draft-js'; interface RichtextContextInterface { editorState: EditorState; setEditorState: (state: EditorState) => void; editor: React.MutableRefObject<Editor>; toggleInlineStyle: (style: string) => void; toggleBlockType: (blockType: string) => void; keyMap: KeyMap; setKeyMap: (keyMap: KeyMap) => void; handleKeypress: (e: React.KeyboardEvent) => string; handleKeyCommand: (command: string) => DraftHandleValue; editorProps: EditorProps; setEditorProps: (props: EditorProps) => void; forceUpdate: () => void; forceUpdateState: boolean; } declare type KeyMap = { key: string; handle: () => void; name: string; ctrlKey?: boolean; altKey?: boolean; }[]; interface RichtextContextProviderProps { defaultKeyMap?: KeyMap; defaultEditorState?: EditorState; } declare const RichtextContextProvider: React.FC<RichtextContextProviderProps>; export declare const useRichtext: () => RichtextContextInterface; export declare const withRichtext: <T extends object>(Component: React.FC<T>) => (props: T) => JSX.Element; export declare const withCustomRichtext: (props: RichtextContextProviderProps) => <T extends object>(Component: React.FC<T>) => (props: T) => JSX.Element; export default RichtextContextProvider;