// Generated by dts-bundle v0.7.3 // Dependencies for this module: // ../react declare module 'react-markdown-editor-lite' { import Editor from 'react-markdown-editor-lite/editor'; export { PluginComponent, PluginProps } from 'react-markdown-editor-lite/plugins/Plugin'; export { default as getDecorated } from 'react-markdown-editor-lite/utils/decorate'; export { default as DropList } from 'react-markdown-editor-lite/components/DropList/index'; export default Editor; } declare module 'react-markdown-editor-lite/editor' { import * as React from 'react'; import { EditorConfig, EditorEvent, KeyboardEventListener, Selection } from 'react-markdown-editor-lite/share/var'; import { HtmlType } from 'react-markdown-editor-lite/editor/preview'; interface EditorProps extends EditorConfig { value?: string; renderHTML: (text: string) => HtmlType | Promise | (() => HtmlType); style?: React.CSSProperties; config?: any; plugins?: string[]; onChange?: (data: { text: string; html: string; }, event?: React.ChangeEvent) => void; } interface EditorState { text: string; html: HtmlType; fullScreen: boolean; plugins: { [x: string]: React.ReactElement[]; }; view: { menu: boolean; md: boolean; html: boolean; }; table: { maxRow: number; maxCol: number; }; } class Editor extends React.Component { static defaultProps: { value: string; }; /** * 注册插件 * @param comp 插件 * @param config 其他配置 */ static use(comp: any, config?: any): void; /** * 设置所使用的语言文案 */ static addLocale: (langName: string, lang: { [x: string]: string; }) => void; static useLocale: (langName: string) => void; static getLocale: () => string; constructor(props: any); componentDidMount(): void; componentWillUnmount(): void; componentDidUpdate(prevProps: EditorProps): void; /** * 清除已选择区域 */ clearSelection(): void; /** * 获取已选择区域 * @return {Selection} */ getSelection(): Selection; /** * 设置已选择区域 * @param {Selection} to */ setSelection(to: { start: number; end: number; }): void; /** * 插入Markdown语法 * @param type * @param option */ insertMarkdown(type: string, option?: any): void; /** * 插入占位符,并在Promise结束后自动覆盖 * @param placeholder * @param wait */ insertPlaceholder(placeholder: string, wait: Promise): void; /** * 插入文本 * @param {string} value 要插入的文本 * @param {boolean} replaceSelected 是否替换掉当前选择的文本 * @param {Selection} newSelection 新的选择区域 */ insertText(value?: string, replaceSelected?: boolean, newSelection?: { start: number; end: number; }): void; /** * 设置文本,同时触发onChange * 注意避免在onChange里面调用此方法,以免造成死循环 * @param {string} value * @param {any} event */ setText(value?: string, event?: React.ChangeEvent, newSelection?: { start: number; end: number; }): void; /** * 获取文本值 * @return {string} */ getMdValue(): string; /** * 获取渲染后的HTML * @returns {string} */ getHtmlValue(): string; onKeyboard(data: KeyboardEventListener): void; offKeyboard(data: KeyboardEventListener): void; on(event: EditorEvent, cb: any): void; off(event: EditorEvent, cb: any): void; /** * 设置视图属性 * 可显示或隐藏:编辑器,预览区域,菜单栏 * @param enable */ setView(to: { md?: boolean; menu?: boolean; html?: boolean; }): void; getView(): { menu: boolean; md: boolean; html: boolean; }; /** * 进入或退出全屏模式 * @param {boolean} enable 是否开启全屏模式 */ fullScreen(enable: boolean): void; isFullScreen(): boolean; render(): JSX.Element; } export default Editor; } declare module 'react-markdown-editor-lite/plugins/Plugin' { import * as React from 'react'; import Editor from 'react-markdown-editor-lite/editor'; import { EditorConfig } from 'react-markdown-editor-lite/share/var'; export interface PluginProps { editor: Editor; editorConfig: EditorConfig; config?: any; } export abstract class PluginComponent extends React.Component { static pluginName: string; static align: string; protected get editor(): Editor; protected get editorConfig(): EditorConfig; constructor(props: P); protected getConfig(key: string, defaultValue?: any): any; } } declare module 'react-markdown-editor-lite/utils/decorate' { interface Decorated { text: string; selection?: { start: number; end: number; }; } /** * 获取装饰后的Markdown文本 * @param target 原文字 * @param type 装饰类型 * @param option 附加参数 * @returns {Decorated} */ function getDecorated(target: string, type: string, option?: any): Decorated; export default getDecorated; } declare module 'react-markdown-editor-lite/components/DropList/index' { import * as React from 'react'; interface DropListProps { show: boolean; onClose?: () => void; } class DropList extends React.Component { constructor(props: any); handleClose(e: React.MouseEvent): void; render(): JSX.Element; } export default DropList; } declare module 'react-markdown-editor-lite/share/var' { import * as React from 'react'; export type UploadFunc = ((file: File) => Promise) | ((file: File, callback: (url: string) => void) => void); export type EditorEvent = 'change' | 'fullscreen' | 'viewchange' | 'keydown'; export interface EditorConfig { theme?: string; name?: string; view?: { menu: boolean; md: boolean; html: boolean; }; canView?: { menu: boolean; md: boolean; html: 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; onCustomImageUpload?: (event: any) => Promise<{ url: string; text?: string; }>; } export interface Selection { start: number; end: number; text: string; } export const initialSelection: Selection; export type KeyboardEventCallback = (e: React.KeyboardEvent) => void; export interface KeyboardEventListener { key?: string; keyCode: number; withKey?: ('ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey')[]; callback: KeyboardEventCallback; } } declare module 'react-markdown-editor-lite/editor/preview' { import * as React from 'react'; export type HtmlType = string | React.ReactElement; export interface PreviewProps { html: HtmlType; className?: string; } export abstract class Preview extends React.Component { protected el: any; constructor(props: any); abstract getHtml(): string; getHeight(): any; } export class HtmlRender extends Preview { getHtml(): any; render(): React.DetailedReactHTMLElement<{ ref: (el: HTMLElement | null) => HTMLElement | null; className: string; }, HTMLElement>; } export default HtmlRender; }