xxxxxxxxxxxxxxxxxxxxxx commited on
Commit
48ecc68
·
1 Parent(s): d711c2c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +141 -0
README.md CHANGED
@@ -1,3 +1,144 @@
1
  ---
2
  license: wtfpl
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: wtfpl
3
  ---
4
+ ```typescript
5
+ import React, { CSSProperties, PropsWithRef } from 'react';
6
+ import MarkdownPreview, { MarkdownPreviewProps } from '@uiw/react-markdown-preview';
7
+ import { ITextAreaProps } from './components/TextArea';
8
+ import { ICommand } from './commands';
9
+ import { ContextStore, PreviewType } from './Context';
10
+ import './index.less';
11
+ export interface IProps {
12
+ prefixCls?: string;
13
+ className?: string;
14
+ }
15
+ export interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, IProps {
16
+ /**
17
+ * The Markdown value.
18
+ */
19
+ value?: string;
20
+ /**
21
+ * Event handler for the `onChange` event.
22
+ */
23
+ onChange?: (value?: string, event?: React.ChangeEvent<HTMLTextAreaElement>, state?: ContextStore) => void;
24
+ /**
25
+ * editor height change listener
26
+ */
27
+ onHeightChange?: (value?: CSSProperties['height'], oldValue?: CSSProperties['height'], state?: ContextStore) => void;
28
+ /**
29
+ * Can be used to make `Markdown Editor` focus itself on initialization. Defaults to on.
30
+ * it will be set to true when either the source `textarea` is focused,
31
+ * or it has an `autofocus` attribute and no other element is focused.
32
+ */
33
+ autoFocus?: ITextAreaProps['autoFocus'];
34
+ /**
35
+ * The height of the editor.
36
+ * ⚠️ `Dragbar` is invalid when **`height`** parameter percentage.
37
+ */
38
+ height?: CSSProperties['height'];
39
+ /**
40
+ * Custom toolbar heigth
41
+ * @default 29px
42
+ *
43
+ * @deprecated toolbar height adaptive: https://github.com/uiwjs/react-md-editor/issues/427
44
+ *
45
+ */
46
+ toolbarHeight?: number;
47
+ /**
48
+ * Show drag and drop tool. Set the height of the editor.
49
+ */
50
+ visibleDragbar?: boolean;
51
+ /**
52
+ * @deprecated use `visibleDragbar`
53
+ */
54
+ visiableDragbar?: boolean;
55
+ /**
56
+ * Show markdown preview.
57
+ */
58
+ preview?: PreviewType;
59
+ /**
60
+ * Full screen display editor.
61
+ */
62
+ fullscreen?: boolean;
63
+ /**
64
+ * Disable `fullscreen` setting body styles
65
+ */
66
+ overflow?: boolean;
67
+ /**
68
+ * Maximum drag height. `visibleDragbar=true`
69
+ */
70
+ maxHeight?: number;
71
+ /**
72
+ * Minimum drag height. `visibleDragbar=true`
73
+ */
74
+ minHeight?: number;
75
+ /**
76
+ * This is reset [react-markdown](https://github.com/rexxars/react-markdown) settings.
77
+ */
78
+ previewOptions?: Omit<MarkdownPreviewProps, 'source'>;
79
+ /**
80
+ * Set the `textarea` related props.
81
+ */
82
+ textareaProps?: ITextAreaProps;
83
+ /**
84
+ * Use div to replace TextArea or re-render TextArea
85
+ * @deprecated Please use ~~`renderTextarea`~~ -> `components`
86
+ */
87
+ renderTextarea?: ITextAreaProps['renderTextarea'];
88
+ /**
89
+ * re-render element
90
+ */
91
+ components?: {
92
+ /** Use div to replace TextArea or re-render TextArea */
93
+ textarea?: ITextAreaProps['renderTextarea'];
94
+ /**
95
+ * Override the default command element
96
+ * _`toolbar`_ < _`command[].render`_
97
+ */
98
+ toolbar?: ICommand['render'];
99
+ /** Custom markdown preview */
100
+ preview?: (source: string, state: ContextStore, dispath: React.Dispatch<ContextStore>) => JSX.Element;
101
+ };
102
+ /**
103
+ * Disable editing area code highlighting. The value is `false`, which increases the editing speed.
104
+ * @default true
105
+ */
106
+ highlightEnable?: boolean;
107
+ /**
108
+ * The number of characters to insert when pressing tab key.
109
+ * Default `2` spaces.
110
+ */
111
+ tabSize?: number;
112
+ /**
113
+ * 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.
114
+ */
115
+ defaultTabEnable?: boolean;
116
+ /**
117
+ * You can create your own commands or reuse existing commands.
118
+ */
119
+ commands?: ICommand[];
120
+ /**
121
+ * Filter or modify your commands.
122
+ * https://github.com/uiwjs/react-md-editor/issues/296
123
+ */
124
+ commandsFilter?: (command: ICommand, isExtra: boolean) => false | ICommand;
125
+ /**
126
+ * You can create your own commands or reuse existing commands.
127
+ */
128
+ extraCommands?: ICommand[];
129
+ /**
130
+ * Hide the tool bar
131
+ */
132
+ hideToolbar?: boolean;
133
+ /** Whether to enable scrolling */
134
+ enableScroll?: boolean;
135
+ /** Toolbar on bottom */
136
+ toolbarBottom?: boolean;
137
+ }
138
+ declare type Editor = React.FC<PropsWithRef<MDEditorProps>> & {
139
+ Markdown: typeof MarkdownPreview;
140
+ };
141
+ declare const mdEditor: Editor;
142
+ export default mdEditor;
143
+
144
+ ```