-
-
Notifications
You must be signed in to change notification settings - Fork 309
/
index.d.ts
336 lines (334 loc) · 7.74 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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
import { DisplayProperty, PositionProperty } from 'csstype';
import CodeMirror from 'codemirror';
declare module 'suneditor' {
export function create(
idOrElement: string | Element,
options: SunEditorOptions,
_init_options?: SunEditorOptions
): any;
export function init(init_options: SunEditorOptions): any;
/**
* SunEditor Options
*/
export interface SunEditorOptions {
/**
* Whitelist
* =========
*/
/**
* Add tags to the default tags whitelist of editor. default: '' {String}
*/
addTagsWhitelist?: string;
/**
* Whitelist of tags when pasting. default: _editorTagsWhitelist {String}
*/
pasteTagsWhitelist?: string;
/**
* Add attributes whitelist of tags that should be kept undeleted from the editor.
*/
attributesWhitelist?: Record<string, string>;
/**
* Layout
* ======
*/
/**
* language object
*/
lang?: object;
/**
* The mode of the editor (classic, inline, balloon)
*/
mode?: 'classic' | 'inline' | 'balloon';
/**
* Button List
*/
buttonList?: ButtonListItem[];
/**
* The width of the toolbar.
Applies only when the editor mode is 'inline' or 'balloon' mode.
*/
toolbarWidth?: string;
/**
* Reference height value that should be changed to sticky toolbar mode
*/
stickyToolbar?: number;
/**
* Content will be placed in an iframe and isolated from the rest of the page
*/
iframe?: boolean;
/**
* Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration
*/
fullPage?: boolean;
/**
* Name of the CSS file to apply inside the iframe.
*/
iframeCSSFileName?: string;
/**
* CodeMirror core object
*/
codeMirror?: object;
/**
* Generated CodeMirror Object
*/
codeMirrorEditor?: CodeMirror;
/**
* Display
* =======
*/
/**
* The position property of editor
*/
position?: PositionProperty;
/**
* The display property of editor
*/
display?: DisplayProperty;
/**
* Size of background area when activating dialog window ('full'||'local')
*/
popupDisplay?: 'full' | 'local';
/**
* Bottom resizing bar
* ===================
*/
/**
* Show the bottom resizing bar
*/
resizingBar?: boolean;
/**
* Displays the current node structure to resizingBar
*/
showPathLabel?: boolean;
/**
* Shows the number of characters in the editor
*/
charCounter?: boolean;
/**
* The maximum number of characters allowed to be inserted into the editor
*/
maxCharCount?: number;
/**
* Size
* ====
*/
/**
* The width size of the editor
*/
width?: string;
/**
* The min-width size of the editor
*/
minWidth?: string;
/**
* The max-width size of the editor
*/
maxWidth?: string;
/**
* The height size of the editor
*/
height?: string;
/**
* The min-height size of the editor
*/
minHeight?: string;
/**
* The max-height size of the editor
*/
maxHeight?: string;
/**
* Defining menu items
* ===================
*/
/**
* Change default font-family array
*/
font?: string[];
/**
* Change default font-size array
*/
fontSize?: number[];
/**
*
*/
fontSizeUnit?: string;
/**
* Change default formatBlock array
*/
formats?: FormatTagName[];
/**
* Change default color array of color picker
*/
colorList?: string[];
/**
* Line Heights
*/
lineHeights?: LineHeightsItem[];
/**
* Paragraph Styles
*/
paragraphStyles?: ParagraphStyles;
/**
* Text Styles
*/
textStyles?: TextStyles;
/**
* Image
* =====
*/
/**
* Can resize the image
*/
imageResizing?: boolean;
/**
* Choose whether the image height input is visible.
*/
imageHeightShow?: boolean;
/**
* The default width size of the image frame
*/
imageWidth?: number;
/**
* If true, image size can only be scaled by percentage.
*/
imageSizeOnlyPercentage?: boolean;
/**
* Choose whether to image rotation buttons display.
* When "imageSizeOnlyPercentage" is "true" or or "imageHeightShow" is "false" the default value is false.
* If you want the button to be visible, put it a true.
*/
imageRotation?: boolean;
/**
* Choose whether to create a file input tag in the image upload window
*/
imageFileInput?: boolean;
/**
* Choose whether to create a image url input tag in the image upload window
*/
imageUrlInput?: boolean;
/**
* Http Header when uploading images.
*/
imageUploadHeader?: Record<string, string>;
/**
* The image upload to server mapping address
*/
imageUploadUrl?: string;
/**
* The size of the total uploadable images (in bytes)
*/
imageUploadSizeLimit?: number;
/**
* Video
* =====
*/
/**
* Can resize the video iframe
*/
videoResizing?: boolean;
/**
* Choose whether the video height input is visible.
*/
videoHeightShow?: boolean;
/**
* Choose whether the video ratio options is visible.
*/
videoRatioShow?: boolean;
/**
* The default width size of the video frame
*/
videoWidth?: number;
/**
* If true, video size can only be scaled by percentage.
*/
videoSizeOnlyPercentage?: boolean;
/**
* Choose whether to video rotation buttons display.
* When "videoSizeOnlyPercentage" is "true" or "videoHeightShow" is "false" the default value is false.
* If you want the button to be visible, put it a true.
*/
videoRotation?: boolean;
/**
* The default aspect ratio of the video.
* Up to four decimal places are allowed.
*/
videoRatio?: number;
/**
* Video ratio selection options.
*/
videoRatioList?: { name: string; value: number }[];
/**
* The default heigth size of the video frame
*/
videoHeight?: number;
/**
* The query string of a YouTube embedded URL
*/
youtubeQuery?: string;
/**
* Defining save button
* ====================
*/
/**
* Callback functions that is called when the Save button is clicked
*/
callBackSave?: (contents: string) => void;
/**
* Templates Array
* ===============
*/
/**
* Templates array
*/
templates?: TemplatesItem[];
/**
* ETC
* ===
*/
/**
* The placeholder text
*/
placeholder?: string;
}
export type FormatTagName = 'p' | 'div' | 'blockquote' | 'pre' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
export type TemplatesItem = { name: string; html: string };
export type LineHeightsItem = { text: string; value: number };
export type ParagraphStyles = [string, { name: string; class: string }];
export type TextStyles = [string, { name: string; style: string; tag: string }];
export type ButtonListDefaults =
| '/' // Line Break
| 'bold'
| 'underline'
| 'italic'
| 'strike'
| 'subscript'
| 'superscript'
| 'removeFormat'
| 'indent'
| 'outdent'
| 'fullScreen'
| 'showBlocks'
| 'codeView'
| 'undo'
| 'redo'
| 'preview'
| 'print'
| 'save'
| 'font'
| 'formatBlock'
| 'fontSize'
| 'fontColor'
| 'hiliteColor'
| 'align'
| 'list'
| 'horizontalRule'
| 'table'
| 'lineHeight'
| 'template'
| 'paragraphStyle'
| 'textStyle'
| 'link'
| 'image'
| 'video';
export type ButtonListItem = ButtonListDefaults | ButtonListDefaults[];
}