wwww
import React, { CSSProperties, PropsWithRef } from 'react';
import MarkdownPreview, { MarkdownPreviewProps } from '@uiw/react-markdown-preview';
import { ITextAreaProps } from './components/TextArea';
import { ICommand } from './commands';
import { ContextStore, PreviewType } from './Context';
import './index.less';
export interface IProps {
prefixCls?: string;
className?: string;
}
export interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, IProps {
/**
* The Markdown value.
*/
value?: string;
/**
* Event handler for the `onChange` event.
*/
onChange?: (value?: string, event?: React.ChangeEvent<HTMLTextAreaElement>, state?: ContextStore) => void;
/**
* editor height change listener
*/
onHeightChange?: (value?: CSSProperties['height'], oldValue?: CSSProperties['height'], state?: ContextStore) => void;
/**
* Can be used to make `Markdown Editor` focus itself on initialization. Defaults to on.
* it will be set to true when either the source `textarea` is focused,
* or it has an `autofocus` attribute and no other element is focused.
*/
autoFocus?: ITextAreaProps['autoFocus'];
/**
* The height of the editor.
* ⚠️ `Dragbar` is invalid when **`height`** parameter percentage.
*/
height?: CSSProperties['height'];
/**
* Custom toolbar heigth
* @default 29px
*
* @deprecated toolbar height adaptive: https://github.com/uiwjs/react-md-editor/issues/427
*
*/
toolbarHeight?: number;
/**
* Show drag and drop tool. Set the height of the editor.
*/
visibleDragbar?: boolean;
/**
* @deprecated use `visibleDragbar`
*/
visiableDragbar?: boolean;
/**
* Show markdown preview.
*/
preview?: PreviewType;
/**
* Full screen display editor.
*/
fullscreen?: boolean;
/**
* Disable `fullscreen` setting body styles
*/
overflow?: boolean;
/**
* Maximum drag height. `visibleDragbar=true`
*/
maxHeight?: number;
/**
* Minimum drag height. `visibleDragbar=true`
*/
minHeight?: number;
/**
* This is reset [react-markdown](https://github.com/rexxars/react-markdown) settings.
*/
previewOptions?: Omit<MarkdownPreviewProps, 'source'>;
/**
* Set the `textarea` related props.
*/
textareaProps?: ITextAreaProps;
/**
* Use div to replace TextArea or re-render TextArea
* @deprecated Please use ~~`renderTextarea`~~ -> `components`
*/
renderTextarea?: ITextAreaProps['renderTextarea'];
/**
* re-render element
*/
components?: {
/** Use div to replace TextArea or re-render TextArea */
textarea?: ITextAreaProps['renderTextarea'];
/**
* Override the default command element
* _`toolbar`_ < _`command[].render`_
*/
toolbar?: ICommand['render'];
/** Custom markdown preview */
preview?: (source: string, state: ContextStore, dispath: React.Dispatch<ContextStore>) => JSX.Element;
};
/**
* Disable editing area code highlighting. The value is `false`, which increases the editing speed.
* @default true
*/
highlightEnable?: boolean;
/**
* The number of characters to insert when pressing tab key.
* Default `2` spaces.
*/
tabSize?: number;
/**
* If `false`, the `tab` key inserts a tab character into the textarea. If `true`, the `tab` key executes default behavior e.g. focus shifts to next element.
*/
defaultTabEnable?: boolean;
/**
* You can create your own commands or reuse existing commands.
*/
commands?: ICommand[];
/**
* Filter or modify your commands.
* https://github.com/uiwjs/react-md-editor/issues/296
*/
commandsFilter?: (command: ICommand, isExtra: boolean) => false | ICommand;
/**
* You can create your own commands or reuse existing commands.
*/
extraCommands?: ICommand[];
/**
* Hide the tool bar
*/
hideToolbar?: boolean;
/** Whether to enable scrolling */
enableScroll?: boolean;
/** Toolbar on bottom */
toolbarBottom?: boolean;
}
declare type Editor = React.FC<PropsWithRef<MDEditorProps>> & {
Markdown: typeof MarkdownPreview;
};
declare const mdEditor: Editor;
export default mdEditor;
asdjk
lskjdflskj
as d s d