react-markdown-editor-lite
Version:
a light-weight Markdown editor based on React
55 lines (54 loc) • 1.6 kB
TypeScript
import * as React from 'react';
export declare type UploadFunc = ((file: File) => Promise<string>) | ((file: File, callback: (url: string) => void) => void);
export declare type EditorEvent = 'change' | 'fullscreen' | 'viewchange' | 'keydown' | 'focus' | 'blur' | 'scroll';
export interface EditorConfig {
theme?: string;
name?: string;
view?: {
menu: boolean;
md: boolean;
html: boolean;
};
canView?: {
menu: boolean;
md: boolean;
html: boolean;
both: boolean;
fullScreen: boolean;
hideMenu: boolean;
};
htmlClass?: string;
markdownClass?: string;
imageUrl?: string;
imageAccept?: string;
linkUrl?: string;
table?: {
maxRow: number;
maxCol: number;
};
syncScrollMode?: string[];
allowPasteImage?: boolean;
onImageUpload?: UploadFunc;
onChangeTrigger?: 'both' | 'beforeRender' | 'afterRender';
onCustomImageUpload?: (event: any) => Promise<{
url: string;
text?: string;
}>;
shortcuts?: boolean;
}
export interface Selection {
start: number;
end: number;
text: string;
}
export declare const initialSelection: Selection;
export declare type KeyboardEventCallback = (e: React.KeyboardEvent<HTMLDivElement>) => void;
export interface KeyboardEventCondition {
key?: string;
keyCode: number;
aliasCommand?: boolean;
withKey?: ('ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey')[];
}
export interface KeyboardEventListener extends KeyboardEventCondition {
callback: KeyboardEventCallback;
}