-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
313 lines (313 loc) · 9.96 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/// <reference types="draft-js" />
/// <reference types="react" />
import * as React from 'react';
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
import './index.css';
import { EditorState } from 'draft-js';
/**
* convert an editor state to html
* @param input any
* @param options DraftToHtml options
*/
export declare const draftToHtml: (input: any, ...options: any[]) => any;
/**
* convert html to Draft State
* @param content your contents
* @return {EditorState}
*/
export declare const htmlToDraft: (content: string) => EditorState;
/**
* convert raw content to Draft State
* @param content your contents
* @return {EditorState}
*/
export declare const rawToDraft: (content: string) => EditorState | undefined;
/**
* convert draft state to raw
* @param content of draft state
* @return Object{entryMap: Object, blocks:Array()}
*/
export declare const draftToRaw: (content: any) => string;
/**
* convert draft state to html
* @param content of draft state
* @return html
*/
export declare const draftStateToHTML: (content: any) => any;
/**
* an empty state
*/
export declare const EmptyState: EditorState;
export declare const A: (arr: any[]) => void[];
export interface DraftProps {
children?: React.ReactNode;
/**
* editor state
*
* @type {*}
* @memberOf DraftProps
*/
editorState?: EditorState;
/**
* default value
*
* @type {EditorState}
* @memberOf DraftProps
*/
defaultEditorState?: EditorState;
/**
* when state has changed
*
*
* @memberOf DraftProps
*/
onEditorStateChange?: (editorState: EditorState) => void;
placeholder?: string;
/**
* tool bar configrations
*
* @type {{
* options: string[]
* inline: {
* options: string[]
* }
* }}
* @memberOf DraftProps
*/
toolbar?: Partial<{
/**
* options
*
* @type {['inline', 'blockType', 'fontSize', 'fontFamily', 'list', 'textAlign', 'colorPicker',
* 'link', 'embedded', 'emoji', 'image', 'remove', 'history']}
*/
options: string[];
inline: Partial<{
inDropdown: false;
className?: string;
/**
* inline options
*
* @type {['bold', 'italic', 'underline', 'strikethrough', 'monospace', 'superscript', 'subscript']}
*/
options: string[];
bold: {
icon: 'bold';
className?: string;
};
italic: {
icon: 'italic';
className?: string;
};
underline: {
icon: 'underline';
className?: string;
};
strikethrough: {
icon: 'strikethrough';
className?: string;
};
monospace: {
icon: 'monospace';
className?: string;
};
superscript: {
icon: 'superscript';
className?: string;
};
subscript: {
icon: 'subscript';
className?: string;
};
}>;
blockType: Partial<{
inDropdown: true;
/**
* blockType options
*
* @type {['Normal', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'Blockquote']}
*/
options: string[];
className?: string;
dropdownclassName?: string;
}>;
fontSize: Partial<{
icon: 'fontSize';
options: number[];
className?: string;
dropdownclassName?: string;
}>;
fontFamily: Partial<{
/**
* fontFamily options
*
* @type {['Arial', 'Georgia', 'Impact', 'Tahoma', 'Times New Roman', 'Verdana']}
*/
options: string[];
className?: string;
dropdownclassName?: string;
}>;
list: Partial<{
inDropdown: false;
className?: string;
/**
* list options
*
* @type {['unordered', 'ordered', 'indent', 'outdent']}
*/
options: string[];
unordered: {
icon: 'unordered';
className?: string;
};
ordered: {
icon: 'ordered';
className?: string;
};
indent: {
icon: 'indent';
className?: string;
};
outdent: {
icon: 'outdent';
className?: string;
};
}>;
textAlign: Partial<{
inDropdown: false;
className?: string;
/**
* textAlign options
*
* @type {['left', 'center', 'right', 'justify']}
*/
options: string[];
left: {
icon: 'left';
className?: string;
};
center: {
icon: 'center';
className?: string;
};
right: {
icon: 'right';
className?: string;
};
justify: {
icon: 'justify';
className?: string;
};
}>;
colorPicker: Partial<{
icon: 'color';
className?: string;
popclassName?: string;
/**
* colorPicker colors
*
* @type {['rgb(97,189,109)', 'rgb(26,188,156)', 'rgb(84,172,210)', 'rgb(44,130,201)',
* 'rgb(147,101,184)', 'rgb(71,85,119)', 'rgb(204,204,204)', 'rgb(65,168,95)', 'rgb(0,168,133)',
* 'rgb(61,142,185)', 'rgb(41,105,176)', 'rgb(85,57,130)', 'rgb(40,50,78)', 'rgb(0,0,0)',
* 'rgb(247,218,100)', 'rgb(251,160,38)', 'rgb(235,107,86)', 'rgb(226,80,65)', 'rgb(163,143,132)',
* 'rgb(239,239,239)', 'rgb(255,255,255)', 'rgb(250,197,28)', 'rgb(243,121,52)', 'rgb(209,72,65)',
* 'rgb(184,49,47)', 'rgb(124,112,107)', 'rgb(209,213,216)']}
*/
colors: string[];
}>;
link: Partial<{
inDropdown: false;
className?: string;
popclassName?: string;
/**
* link options
*
* @type {['link', 'unlink']}
*/
options: string[];
link: {
icon: 'link';
className?: string;
};
unlink: {
icon: 'unlink';
className?: string;
};
}>;
embedded: Partial<{
icon: 'image';
className?: string;
popclassName?: string;
}>;
emoji: Partial<{
icon: 'emoji';
className?: string;
popclassName?: string;
/**
* emoji
*
* @type {['😀', '😁', '😂', '😃', '😉', '😋', '😎', '😍', '😗', '🤗', '🤔', '😣', '😫', '😴', '😌',
* '🤓', '😛', '😜', '😠', '😇', '😷', '😈', '👻', '😺', '😸', '😹', '😻', '😼', '😽', '🙀', '🙈', '🙉', '🙊',
* '👼', '👮', '🕵', '💂', '👳', '🎅', '👸', '👰', '👲', '🙍', '🙇', '🚶', '🏃', '💃',
* '⛷', '🏂', '🏌', '🏄', '🚣', '🏊', '⛹', '🏋', '🚴', '👫', '💪', '👈', '👉', '👉', '👆', '🖕', '👇',
* '🖖', '🤘', '🖐', '👌', '👍', '👎', '✊', '👊', '👏', '🙌', '🙏', '🐵', '🐶',
* '🐇', '🐥', '🐸', '🐌', '🐛', '🐜', '🐝', '🍉', '🍄', '🍔', '🍤', '🍨', '🍪', '🎂', '🍰', '🍾', '🍷', '🍸',
* '🍺', '🌍', '🚑', '⏰', '🌙', '🌝', '🌞', '⭐', '🌟', '🌠', '🌨', '🌩', '⛄', '🔥', '🎄', '🎈', '🎉',
* '🎊', '🎁', '🎗', '🏀', '🏈', '🎲', '🔇', '🔈', '📣', '🔔', '🎵', '🎷',
* '💰', '🖊', '📅', '✅', '❎', '💯']}
*/
emojis: string[];
}>;
image: Partial<{
icon: 'image';
className?: string;
popupclassName?: string;
urlEnabled: true;
uploadEnabled: true;
alignmentEnabled: false;
uploadCallback: undefined;
defaultSize: {
height: 'auto';
width: '100%';
};
}>;
remove: Partial<{
icon: 'eraser';
className?: string;
}>;
history: Partial<{
inDropdown: false;
className?: string;
/**
* history
*
* @type {['undo', 'redo']}
*/
options: string[];
undo: {
icon: 'undo';
className?: string;
};
redo: {
icon: 'redo';
className?: string;
};
}>;
}>;
/** */
locale?: string;
[key: string]: any;
}
export interface DraftState {
}
/**
* Draft
*
* @class Draft
* @extends {React.Component<DraftProps, DraftState>}
*/
declare class Draft extends React.Component<DraftProps, DraftState> {
static defaultProps: DraftProps;
render(): JSX.Element;
}
export default Draft;