suneditor 2.47.4 → 2.47.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/LICENSE.txt +20 -20
  2. package/README.md +1625 -1613
  3. package/dist/suneditor.min.js +2 -2
  4. package/example.md +586 -586
  5. package/package.json +71 -71
  6. package/src/assets/css/suneditor-contents.css +561 -561
  7. package/src/assets/css/suneditor.css +0 -0
  8. package/src/assets/defaultIcons.js +103 -103
  9. package/src/lang/Lang.d.ts +143 -143
  10. package/src/lang/ckb.d.ts +4 -4
  11. package/src/lang/ckb.js +187 -187
  12. package/src/lang/cs.d.ts +4 -4
  13. package/src/lang/cs.js +187 -187
  14. package/src/lang/da.d.ts +4 -4
  15. package/src/lang/da.js +191 -191
  16. package/src/lang/de.d.ts +4 -4
  17. package/src/lang/de.js +188 -188
  18. package/src/lang/en.d.ts +4 -4
  19. package/src/lang/en.js +187 -187
  20. package/src/lang/es.d.ts +4 -4
  21. package/src/lang/es.js +187 -187
  22. package/src/lang/fa.d.ts +4 -4
  23. package/src/lang/fa.js +187 -187
  24. package/src/lang/fr.d.ts +4 -4
  25. package/src/lang/fr.js +188 -188
  26. package/src/lang/he.d.ts +4 -4
  27. package/src/lang/he.js +188 -188
  28. package/src/lang/hu.d.ts +5 -5
  29. package/src/lang/hu.js +188 -188
  30. package/src/lang/index.d.ts +25 -24
  31. package/src/lang/index.js +30 -27
  32. package/src/lang/it.d.ts +4 -4
  33. package/src/lang/it.js +188 -188
  34. package/src/lang/ja.d.ts +4 -4
  35. package/src/lang/ja.js +187 -187
  36. package/src/lang/km.d.ts +5 -0
  37. package/src/lang/km.js +188 -0
  38. package/src/lang/ko.d.ts +4 -4
  39. package/src/lang/ko.js +187 -187
  40. package/src/lang/lv.d.ts +4 -4
  41. package/src/lang/lv.js +187 -187
  42. package/src/lang/nl.d.ts +4 -4
  43. package/src/lang/nl.js +187 -187
  44. package/src/lang/pl.d.ts +4 -4
  45. package/src/lang/pl.js +187 -187
  46. package/src/lang/pt_br.d.ts +4 -4
  47. package/src/lang/pt_br.js +189 -189
  48. package/src/lang/ro.d.ts +4 -4
  49. package/src/lang/ro.js +187 -187
  50. package/src/lang/ru.d.ts +4 -4
  51. package/src/lang/ru.js +187 -187
  52. package/src/lang/se.d.ts +4 -4
  53. package/src/lang/se.js +191 -191
  54. package/src/lang/tr.d.ts +5 -5
  55. package/src/lang/tr.js +191 -191
  56. package/src/lang/ua.d.ts +5 -5
  57. package/src/lang/ua.js +188 -188
  58. package/src/lang/ur.d.ts +4 -4
  59. package/src/lang/ur.js +187 -187
  60. package/src/lang/zh_cn.d.ts +4 -4
  61. package/src/lang/zh_cn.js +187 -187
  62. package/src/lib/constructor.js +0 -0
  63. package/src/lib/context.d.ts +42 -42
  64. package/src/lib/context.js +0 -0
  65. package/src/lib/core.d.ts +1135 -1135
  66. package/src/lib/core.js +13 -3
  67. package/src/lib/history.d.ts +48 -48
  68. package/src/lib/history.js +218 -218
  69. package/src/lib/util.d.ts +677 -677
  70. package/src/lib/util.js +1 -1
  71. package/src/options.d.ts +621 -620
  72. package/src/plugins/CommandPlugin.d.ts +7 -7
  73. package/src/plugins/DialogPlugin.d.ts +19 -19
  74. package/src/plugins/FileBrowserPlugin.d.ts +29 -29
  75. package/src/plugins/Module.d.ts +14 -14
  76. package/src/plugins/Plugin.d.ts +41 -41
  77. package/src/plugins/SubmenuPlugin.d.ts +7 -7
  78. package/src/plugins/command/blockquote.d.ts +4 -4
  79. package/src/plugins/command/blockquote.js +46 -46
  80. package/src/plugins/dialog/audio.d.ts +4 -4
  81. package/src/plugins/dialog/audio.js +558 -558
  82. package/src/plugins/dialog/image.d.ts +4 -4
  83. package/src/plugins/dialog/image.js +1127 -1127
  84. package/src/plugins/dialog/link.d.ts +4 -4
  85. package/src/plugins/dialog/link.js +223 -223
  86. package/src/plugins/dialog/math.d.ts +4 -4
  87. package/src/plugins/dialog/math.js +300 -300
  88. package/src/plugins/dialog/video.d.ts +4 -4
  89. package/src/plugins/dialog/video.js +989 -989
  90. package/src/plugins/fileBrowser/imageGallery.d.ts +4 -4
  91. package/src/plugins/fileBrowser/imageGallery.js +64 -64
  92. package/src/plugins/index.d.ts +79 -79
  93. package/src/plugins/index.js +32 -32
  94. package/src/plugins/modules/_anchor.js +461 -461
  95. package/src/plugins/modules/_colorPicker.d.ts +59 -59
  96. package/src/plugins/modules/_colorPicker.js +0 -0
  97. package/src/plugins/modules/_notice.d.ts +20 -20
  98. package/src/plugins/modules/_notice.js +72 -72
  99. package/src/plugins/modules/_selectMenu.js +118 -118
  100. package/src/plugins/modules/component.d.ts +24 -24
  101. package/src/plugins/modules/component.js +80 -80
  102. package/src/plugins/modules/dialog.d.ts +27 -27
  103. package/src/plugins/modules/dialog.js +174 -174
  104. package/src/plugins/modules/fileBrowser.d.ts +41 -41
  105. package/src/plugins/modules/fileBrowser.js +377 -377
  106. package/src/plugins/modules/fileManager.d.ts +66 -66
  107. package/src/plugins/modules/fileManager.js +325 -325
  108. package/src/plugins/modules/index.d.ts +10 -10
  109. package/src/plugins/modules/index.js +8 -8
  110. package/src/plugins/modules/resizing.d.ts +153 -153
  111. package/src/plugins/modules/resizing.js +902 -902
  112. package/src/plugins/submenu/align.d.ts +4 -4
  113. package/src/plugins/submenu/align.js +160 -160
  114. package/src/plugins/submenu/font.d.ts +4 -4
  115. package/src/plugins/submenu/font.js +123 -123
  116. package/src/plugins/submenu/fontColor.d.ts +4 -4
  117. package/src/plugins/submenu/fontColor.js +0 -0
  118. package/src/plugins/submenu/fontSize.d.ts +4 -4
  119. package/src/plugins/submenu/fontSize.js +112 -112
  120. package/src/plugins/submenu/formatBlock.d.ts +4 -4
  121. package/src/plugins/submenu/formatBlock.js +273 -273
  122. package/src/plugins/submenu/hiliteColor.d.ts +4 -4
  123. package/src/plugins/submenu/hiliteColor.js +0 -0
  124. package/src/plugins/submenu/horizontalRule.d.ts +4 -4
  125. package/src/plugins/submenu/horizontalRule.js +98 -98
  126. package/src/plugins/submenu/lineHeight.d.ts +4 -4
  127. package/src/plugins/submenu/lineHeight.js +104 -104
  128. package/src/plugins/submenu/list.d.ts +4 -4
  129. package/src/plugins/submenu/list.js +456 -456
  130. package/src/plugins/submenu/paragraphStyle.d.ts +4 -4
  131. package/src/plugins/submenu/paragraphStyle.js +135 -135
  132. package/src/plugins/submenu/table.d.ts +4 -4
  133. package/src/plugins/submenu/template.d.ts +4 -4
  134. package/src/plugins/submenu/template.js +71 -71
  135. package/src/plugins/submenu/textStyle.d.ts +4 -4
  136. package/src/plugins/submenu/textStyle.js +167 -167
  137. package/src/suneditor.d.ts +9 -9
  138. package/src/suneditor.js +75 -75
  139. package/src/suneditor_build.js +17 -17
  140. package/README_V3_TEMP.md +0 -630
package/src/options.d.ts CHANGED
@@ -1,620 +1,621 @@
1
- import { Lang } from './lang/Lang';
2
- import { Plugin } from './plugins/Plugin';
3
-
4
- export interface SunEditorOptions {
5
- plugins?: Plugin[] | Record<string, Plugin>;
6
- /**
7
- * Option to disable clean mode, which checks the styles, classes, etc. of the editor content
8
- */
9
- strictMode?: boolean;
10
- /**
11
- * Enforces strict HTML validation based on the editor`s policy. Applies to methods like setContents to ensure content compliance when enabled.
12
- */
13
- strictHTMLValidation?: boolean;
14
- /**
15
- * Values
16
- * ======
17
- */
18
- /**
19
- * language object
20
- */
21
- lang?: Lang;
22
- /**
23
- * Specifies default tag name of the editor. (default: "p")
24
- */
25
- defaultTag?: string;
26
- /**
27
- * You can change the tag of the default text button. default: { bold: 'STRONG', underline: 'U', italic: 'EM', strike: 'DEL', sub: 'SUB', sup: 'SUP' }
28
- */
29
- textTags?: { bold?: string; underline?: string; italic?: string; strike?: string; sub?: string; sup?: string;};
30
- /**
31
- * Initial value(html string) of the edit area.
32
- * If not, the value of the "target textarea".
33
- */
34
- value?: string;
35
- /**
36
- * When recording the history stack, this is the delay time (miliseconds) since the last input. default: 400
37
- */
38
- historyStackDelayTime?: number;
39
- /**
40
- * Whitelist
41
- * ======
42
- */
43
- /**
44
- * Add tags to the default tags whitelist of editor.
45
- */
46
- addTagsWhitelist?: string | '*';
47
- /**
48
- * Blacklist of the editor default tags.
49
- */
50
- tagsBlacklist?: string;
51
- /**
52
- * Whitelist of tags when pasting.
53
- */
54
- pasteTagsWhitelist?: string | '*';
55
- /**
56
- * Blacklist of tags when pasting.
57
- */
58
- pasteTagsBlacklist?: string;
59
- /**
60
- * Add attributes whitelist of tags that should be kept undeleted from the editor.
61
- */
62
- attributesWhitelist?: Record<string, string | '*'>;
63
- /**
64
- * Add attribute blacklist of tags that should be deleted in editor.
65
- */
66
- attributesBlacklist?: Record<string, string | '*'>;
67
- /**
68
- * Layout
69
- * ======
70
- */
71
- /**
72
- * The mode of the editor (classic, inline, balloon, balloon-always)
73
- */
74
- mode?: 'classic' | 'inline' | 'balloon' | 'balloon-always';
75
- /**
76
- * If true, the editor is set to RTL(Right To Left) mode.
77
- */
78
- rtl?: boolean;
79
- /**
80
- * Deletes other attributes except for the property set at the time of line break.
81
- * If there is no value, no all attribute is deleted.
82
- * @example 'class|style': Attributes other than "class" and "style" are deleted at line break.
83
- * '*': All attributes are deleted at line break.
84
- */
85
- lineAttrReset?: string;
86
- /**
87
- * Button List
88
- */
89
- buttonList?: ButtonListItem[];
90
- /**
91
- * The width of the toolbar.
92
- Applies only when the editor mode is 'inline' or 'balloon' mode.
93
- */
94
- toolbarWidth?: string;
95
- /**
96
- * A custom HTML selector placing the toolbar inside.
97
- The class name of the element must be 'sun-editor'.
98
- Element or querySelector argument.
99
- */
100
- toolbarContainer?: HTMLElement | string;
101
- /**
102
- * Top offset value of "sticky toolbar".
103
- */
104
- stickyToolbar?: number | string;
105
- /**
106
- * The toolbar is rendered hidden.
107
- */
108
- hideToolbar?: boolean;
109
- /**
110
- * Top offset value of "full Screen".
111
- */
112
- fullScreenOffset?: number | string;
113
- /**
114
- * Content will be placed in an iframe and isolated from the rest of the page
115
- */
116
- iframe?: boolean;
117
- /**
118
- * Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration
119
- */
120
- fullPage?: boolean;
121
- /**
122
- * Attributes of the iframe.
123
- */
124
- iframeAttributes?: Record<string, string>;
125
- /**
126
- * Name of the CSS file(s) to apply inside the iframe.
127
- */
128
- iframeCSSFileName?: string | string[];
129
- /**
130
- * A template of the "preview".
131
- * The {{contents}} part in the HTML string is replaced with the contents of the editor.
132
- * @example "<h1>Preview Template</h1> {{contents}} <div>_Footer_</div>"
133
- */
134
- previewTemplate?: string;
135
- /**
136
- * A template of the "print".
137
- * The {{contents}} part in the HTML string is replaced with the contents of the editor.
138
- * @example "<h1>Print Template</h1> {{contents}} <div>_Footer_</div>"
139
- */
140
- printTemplate?: string;
141
- /**
142
- * CodeMirror object
143
- */
144
- codeMirror?: any | { src: any; options: object };
145
- /**
146
- * Katex object (Use "math" plugin)
147
- */
148
- katex?: any | { src: any; options: object };
149
- /**
150
- * Math plugin font size list
151
- */
152
- mathFontSize?: { text: string; value: string; default?: boolean; }[];
153
- /**
154
- * Display
155
- * =======
156
- */
157
- /**
158
- * The position property of editor
159
- */
160
- position?: string;
161
- /**
162
- * The display property of editor
163
- */
164
- display?: string;
165
- /**
166
- * Size of background area when activating dialog window ('full'||'local')
167
- */
168
- popupDisplay?: 'full' | 'local';
169
- /**
170
- * Bottom resizing bar
171
- * ===================
172
- */
173
- /**
174
- * Show the bottom resizing bar
175
- */
176
- resizingBar?: boolean;
177
- /**
178
- * Displays the current node structure to resizingBar
179
- */
180
- showPathLabel?: boolean;
181
- /**
182
- * Enable/disable resize function of bottom resizing bar.
183
- */
184
- resizeEnable?: boolean;
185
- /**
186
- * A custom HTML selector placing the resizing bar inside.
187
- The class name of the element must be 'sun-editor'.
188
- Element or querySelector argument.
189
- */
190
- resizingBarContainer?: HTMLElement | string;
191
- /**
192
- * Character count
193
- * ===============
194
- */
195
- /**
196
- * Shows the number of characters in the editor
197
- */
198
- charCounter?: boolean;
199
- /**
200
- * Defines the calculation method of the "charCounter" option
201
- */
202
- charCounterType?: 'char' | 'byte' | 'byte-html';
203
- /**
204
- * Text to be displayed in the "charCounter" area of the bottom bar.
205
- */
206
- charCounterLabel?: string;
207
- /**
208
- * The maximum number of characters allowed to be inserted into the editor
209
- */
210
- maxCharCount?: number;
211
- /**
212
- * Size
213
- * ====
214
- */
215
- /**
216
- * The width size of the editor
217
- */
218
- width?: string;
219
- /**
220
- * The min-width size of the editor
221
- */
222
- minWidth?: string;
223
- /**
224
- * The max-width size of the editor
225
- */
226
- maxWidth?: string;
227
- /**
228
- * The height size of the editor
229
- */
230
- height?: string;
231
- /**
232
- * The min-height size of the editor
233
- */
234
- minHeight?: string;
235
- /**
236
- * The max-height size of the editor
237
- */
238
- maxHeight?: string;
239
- /**
240
- * Editing area
241
- * ===================
242
- */
243
- /**
244
- * Add a "class" to the editing area[.sun-editor-editable]
245
- */
246
- className?: string;
247
- /**
248
- * You can define the style of the editing area[.sun-editor-editable].
249
- * It affects the entire editing area.
250
- * ('z-index', 'position' and 'width' properties apply to the top div.)
251
- * @example 'font-family: cursive; font-size: 10px;'
252
- */
253
- defaultStyle?: string;
254
- /**
255
- * Defining menu items
256
- * ===================
257
- */
258
- /**
259
- * Change default font-family array
260
- */
261
- font?: string[];
262
- /**
263
- * Change default font-size array
264
- */
265
- fontSize?: number[];
266
- /**
267
- * The font size unit
268
- */
269
- fontSizeUnit?: string;
270
- /**
271
- * A list of drop-down options for the 'align' plugin.
272
- */
273
- alignItems?: ('left' | 'center' | 'right' | 'justify')[];
274
- /**
275
- * Change default formatBlock array
276
- */
277
- formats?: FormatTagName[];
278
- /**
279
- * Change default color array of color picker
280
- */
281
- colorList?: string[];
282
- /**
283
- * Line Heights
284
- */
285
- lineHeights?: LineHeightsItem[];
286
- /**
287
- * Paragraph Styles
288
- */
289
- paragraphStyles?: ParagraphStyles;
290
- /**
291
- * Text Styles
292
- */
293
- textStyles?: TextStyles;
294
- /**
295
- * Image
296
- * =====
297
- */
298
- /**
299
- * Can resize the image
300
- */
301
- imageResizing?: boolean;
302
- /**
303
- * Choose whether the image height input is visible.
304
- */
305
- imageHeightShow?: boolean;
306
- /**
307
- * Choose whether the image align radio buttons are visible.
308
- */
309
- imageAlignShow?: boolean;
310
- /**
311
- * The default width size of the image frame
312
- */
313
- imageWidth?: string;
314
- /**
315
- * The default height size of the image frame
316
- */
317
- imageHeight?: string;
318
- /**
319
- * If true, image size can only be scaled by percentage.
320
- */
321
- imageSizeOnlyPercentage?: boolean;
322
- /**
323
- * It is determined by "imageSizeOnlyPercentage".
324
- * @pivate
325
- */
326
- _videoSizeUnit?: '%' | 'px';
327
- /**
328
- * Choose whether to image rotation buttons display.
329
- * When "imageSizeOnlyPercentage" is "true" or or "imageHeightShow" is "false" the default value is false.
330
- * If you want the button to be visible, put it a true.
331
- */
332
- imageRotation?: boolean;
333
- /**
334
- * Choose whether to create a file input tag in the image upload window
335
- */
336
- imageFileInput?: boolean;
337
- /**
338
- * Choose whether to create a image url input tag in the image upload window
339
- */
340
- imageUrlInput?: boolean;
341
- /**
342
- * Http Header when uploading images.
343
- */
344
- imageUploadHeader?: Record<string, string>;
345
- /**
346
- * The image upload to server mapping address
347
- */
348
- imageUploadUrl?: string;
349
- /**
350
- * The size of the total uploadable images (in bytes)
351
- */
352
- imageUploadSizeLimit?: number;
353
- /**
354
- * If true, multiple images can be selected.
355
- */
356
- imageMultipleFile?: boolean;
357
- /**
358
- * Define the "accept" attribute of the input.
359
- * @example "*" or ".jpg, .png .."
360
- */
361
- imageAccept?: string;
362
- /**
363
- * Image - image gallery
364
- * =====
365
- */
366
- /**
367
- * Direct JSON data without making server requests.
368
- */
369
- imageGalleryData?: Array<any>;
370
- /**
371
- * The url of the image gallery, if you use the image gallery
372
- */
373
- imageGalleryUrl?: string;
374
- /**
375
- * Http Header when get image gallery.
376
- */
377
- imageGalleryHeader?: Record<string, string>;
378
- /**
379
- * Video
380
- * =====
381
- */
382
- /**
383
- * Can resize the video iframe
384
- */
385
- videoResizing?: boolean;
386
- /**
387
- * Choose whether the video height input is visible.
388
- */
389
- videoHeightShow?: boolean;
390
- /**
391
- * Choose whether the video align radio buttons are visible.
392
- */
393
- videoAlignShow?: boolean;
394
- /**
395
- * Choose whether the video ratio options is visible.
396
- */
397
- videoRatioShow?: boolean;
398
- /**
399
- * The default width size of the video frame
400
- */
401
- videoWidth?: string;
402
- /**
403
- * The default height size of the video frame
404
- */
405
- videoHeight?: string;
406
- /**
407
- * If true, video size can only be scaled by percentage.
408
- */
409
- videoSizeOnlyPercentage?: boolean;
410
- /**
411
- * Choose whether to video rotation buttons display.
412
- * When "videoSizeOnlyPercentage" is "true" or "videoHeightShow" is "false" the default value is false.
413
- * If you want the button to be visible, put it a true.
414
- */
415
- videoRotation?: boolean;
416
- /**
417
- * The default aspect ratio of the video.
418
- * Up to four decimal places are allowed.
419
- */
420
- videoRatio?: number;
421
- /**
422
- * Video ratio selection options.
423
- */
424
- videoRatioList?: { name: string; value: number }[];
425
- /**
426
- * The query string of a YouTube embedded URL
427
- */
428
- youtubeQuery?: string;
429
- /**
430
- * Choose whether to create a file input tag in the video upload window
431
- */
432
- videoFileInput?: boolean;
433
- /**
434
- * Choose whether to create a video url input tag in the video upload window
435
- */
436
- videoUrlInput?: boolean;
437
- /**
438
- * Http Header when uploading videos.
439
- */
440
- videoUploadHeader?: Record<string, string>;
441
- /**
442
- * The video upload to server mapping address
443
- */
444
- videoUploadUrl?: string;
445
- /**
446
- * The size of the total uploadable videos (in bytes)
447
- */
448
- videoUploadSizeLimit?: number;
449
- /**
450
- * If true, multiple videos can be selected.
451
- */
452
- videoMultipleFile?: boolean;
453
- /**
454
- * Define "Attributes" of the video tag.
455
- * @example { poster: "http://suneditor.com/docs/loading.gif", autoplay: true }
456
- */
457
- videoTagAttrs?: Record<string, string | boolean>;
458
- /**
459
- * Define "Attributes" of the iframe tag. (Youtube, Vimeo).
460
- * @example { style: "border: 2px solid red;" }
461
- */
462
- videoIframeAttrs?: Record<string, string | boolean>;
463
- /**
464
- * Define the "accept" attribute of the input.
465
- * "*" or ".mp4, .avi .."
466
- */
467
- videoAccept?: string;
468
- /**
469
- * Audio
470
- * =====
471
- */
472
- /**
473
- * The default width size of the audio frame
474
- */
475
- audioWidth?: string;
476
- /**
477
- * The default height size of the audio frame
478
- */
479
- audioHeight?: string;
480
- /**
481
- * Choose whether to create a file input tag in the audio upload window
482
- */
483
- audioFileInput?: boolean;
484
- /**
485
- * Choose whether to create a audio url input tag in the audio upload window
486
- */
487
- audioUrlInput?: boolean;
488
- /**
489
- * Http Header when uploading audios.
490
- */
491
- audioUploadHeader?: Record<string, string>;
492
- /**
493
- * The audio upload to server mapping address
494
- */
495
- audioUploadUrl?: string;
496
- /**
497
- * The size of the total uploadable audios (in bytes)
498
- */
499
- audioUploadSizeLimit?: number;
500
- /**
501
- * If true, videos images can be selected.
502
- */
503
- audioMultipleFile?: boolean;
504
- /**
505
- * Define "Attributes" of the audio tag.
506
- * @example { controlslist: "nodownload", autoplay: true }
507
- */
508
- audioTagAttrs?: Record<string, string | boolean>;
509
- /**
510
- * Define the "accept" attribute of the input.
511
- * "*" or ".mp3, .wav .."
512
- */
513
- audioAccept?: string;
514
- /**
515
- * Table
516
- * =====
517
- */
518
- /**
519
- * Define position to the table cell controller. ('cell', 'top')
520
- */
521
- tableCellControllerPosition?: string;
522
- /**
523
- * Link
524
- * =====
525
- */
526
- /**
527
- * Default checked value of the "Open in new window" checkbox.
528
- */
529
- linkTargetNewWindow?: boolean;
530
- /**
531
- * Protocol for the links (if link has been added without any protocol this one will be used).
532
- */
533
- linkProtocol?: string;
534
- /**
535
- * Defines "rel" attribute list of anchor tag.
536
- */
537
- linkRel?: string[];
538
- /**
539
- * Defines default "rel" attribute list of anchor tag.
540
- */
541
- linkRelDefault?: {default?: string; check_new_window?: string; check_bookmark?: string;};
542
- /**
543
- * If true, disables the automatic prefixing of the host URL to the value of the link. default: false {Boolean}
544
- */
545
- linkNoPrefix?: boolean;
546
- /*
547
- * HR
548
- * =====
549
- */
550
- /**
551
- * Defines the hr items.
552
- * "class" or "style" must be specified.
553
- * @example [{name: "solid", class: "__se__xxx", style: "border-style: outset;"}]
554
- */
555
- hrItems?: { name: string; class?: string; style?: string }[];
556
- /**
557
- * Key actions
558
- * =====
559
- */
560
- /**
561
- * If true, disables the interaction of the editor and tab key
562
- */
563
- tabDisable?: boolean;
564
- shortcutsDisable?: string[];
565
- shortcutsHint?: boolean;
566
- /**
567
- * Defining save button
568
- * ====================
569
- */
570
- /**
571
- * Callback functions that is called when the Save button is clicked
572
- */
573
- callBackSave?: (contents: string, isChanged: boolean) => void;
574
- /**
575
- * Templates Array
576
- * ===============
577
- */
578
- /**
579
- * Templates array
580
- */
581
- templates?: TemplatesItem[];
582
- /**
583
- * ETC
584
- * ===
585
- */
586
- /**
587
- * The placeholder text
588
- */
589
- placeholder?: string;
590
- /**
591
- * Activate the media[image, video, audio] selection status immediately after inserting the media tag. (default: true)
592
- */
593
- mediaAutoSelect?: boolean;
594
- /**
595
- * You can redefine icons.
596
- */
597
- icons?: Record<string, string>;
598
-
599
- /**
600
- * private options
601
- */
602
- _printClass?: string;
603
- }
604
- export type FormatTagName =
605
- 'p'
606
- | 'div'
607
- | 'blockquote'
608
- | 'pre'
609
- | 'h1'
610
- | 'h2'
611
- | 'h3'
612
- | 'h4'
613
- | 'h5'
614
- | 'h6'
615
- | { tag: string; name?: string; command: 'replace' | 'range' | 'free'; class: string };
616
- export type TemplatesItem = { name: string; html: string };
617
- export type LineHeightsItem = { text: string; value: number };
618
- export type ParagraphStyles = (string | { name: string; class: string; _class?: string })[];
619
- export type TextStyles = (string | { name: string; style: string; tag: string; _class?: string })[];
620
- export type ButtonListItem = any;
1
+ import { Lang } from './lang/Lang';
2
+ import { Plugin } from './plugins/Plugin';
3
+
4
+ export interface SunEditorOptions {
5
+ plugins?: Plugin[] | Record<string, Plugin>;
6
+ /**
7
+ * Option to disable clean mode, which checks the styles, classes, etc. of the editor content
8
+ */
9
+ strictMode?: boolean;
10
+ /**
11
+ * Enforces strict HTML validation based on the editor`s policy. Applies to methods like setContents to ensure content compliance when enabled.
12
+ */
13
+ strictHTMLValidation?: boolean;
14
+ /**
15
+ * Values
16
+ * ======
17
+ */
18
+ /**
19
+ * language object
20
+ */
21
+ lang?: Lang;
22
+ /**
23
+ * Specifies default tag name of the editor. (default: "p")
24
+ */
25
+ defaultTag?: string;
26
+ /**
27
+ * You can change the tag of the default text button. default: { bold: 'STRONG', underline: 'U', italic: 'EM', strike: 'DEL', sub: 'SUB', sup: 'SUP' }
28
+ */
29
+ textTags?: { bold?: string; underline?: string; italic?: string; strike?: string; sub?: string; sup?: string;};
30
+ /**
31
+ * Initial value(html string) of the edit area.
32
+ * If not, the value of the "target textarea".
33
+ */
34
+ value?: string;
35
+ /**
36
+ * When recording the history stack, this is the delay time (miliseconds) since the last input. default: 400
37
+ */
38
+ historyStackDelayTime?: number;
39
+ /**
40
+ * Whitelist
41
+ * ======
42
+ */
43
+ /**
44
+ * Add tags to the default tags whitelist of editor.
45
+ */
46
+ addTagsWhitelist?: string | '*';
47
+ /**
48
+ * Blacklist of the editor default tags.
49
+ */
50
+ tagsBlacklist?: string;
51
+ /**
52
+ * Whitelist of tags when pasting.
53
+ */
54
+ pasteTagsWhitelist?: string | '*';
55
+ /**
56
+ * Blacklist of tags when pasting.
57
+ */
58
+ pasteTagsBlacklist?: string;
59
+ /**
60
+ * Add attributes whitelist of tags that should be kept undeleted from the editor.
61
+ */
62
+ attributesWhitelist?: Record<string, string | '*'>;
63
+ /**
64
+ * Add attribute blacklist of tags that should be deleted in editor.
65
+ */
66
+ attributesBlacklist?: Record<string, string | '*'>;
67
+ /**
68
+ * Layout
69
+ * ======
70
+ */
71
+ /**
72
+ * The mode of the editor (classic, inline, balloon, balloon-always)
73
+ */
74
+ mode?: 'classic' | 'inline' | 'balloon' | 'balloon-always';
75
+ /**
76
+ * If true, the editor is set to RTL(Right To Left) mode.
77
+ */
78
+ rtl?: boolean;
79
+ /**
80
+ * Deletes other attributes except for the property set at the time of line break.
81
+ * If there is no value, no all attribute is deleted.
82
+ * @example 'class|style': Attributes other than "class" and "style" are deleted at line break.
83
+ * '*': All attributes are deleted at line break.
84
+ */
85
+ lineAttrReset?: string;
86
+ /**
87
+ * Button List
88
+ */
89
+ buttonList?: ButtonListItem[];
90
+ /**
91
+ * The width of the toolbar.
92
+ Applies only when the editor mode is 'inline' or 'balloon' mode.
93
+ */
94
+ toolbarWidth?: string;
95
+ /**
96
+ * A custom HTML selector placing the toolbar inside.
97
+ The class name of the element must be 'sun-editor'.
98
+ Element or querySelector argument.
99
+ */
100
+ toolbarContainer?: HTMLElement | string;
101
+ /**
102
+ * Top offset value of "sticky toolbar".
103
+ */
104
+ stickyToolbar?: number | string;
105
+ /**
106
+ * The toolbar is rendered hidden.
107
+ */
108
+ hideToolbar?: boolean;
109
+ /**
110
+ * Top offset value of "full Screen".
111
+ */
112
+ fullScreenOffset?: number | string;
113
+ /**
114
+ * Content will be placed in an iframe and isolated from the rest of the page
115
+ */
116
+ iframe?: boolean;
117
+ /**
118
+ * Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration
119
+ */
120
+ fullPage?: boolean;
121
+ /**
122
+ * Attributes of the iframe.
123
+ */
124
+ iframeAttributes?: Record<string, string>;
125
+ /**
126
+ * Name of the CSS file(s) to apply inside the iframe.
127
+ */
128
+ iframeCSSFileName?: string | string[];
129
+ /**
130
+ * A template of the "preview".
131
+ * The {{contents}} part in the HTML string is replaced with the contents of the editor.
132
+ * @example "<h1>Preview Template</h1> {{contents}} <div>_Footer_</div>"
133
+ */
134
+ previewTemplate?: string;
135
+ /**
136
+ * A template of the "print".
137
+ * The {{contents}} part in the HTML string is replaced with the contents of the editor.
138
+ * @example "<h1>Print Template</h1> {{contents}} <div>_Footer_</div>"
139
+ */
140
+ printTemplate?: string;
141
+ /**
142
+ * CodeMirror object
143
+ */
144
+ codeMirror?: any | { src: any; options: object };
145
+ /**
146
+ * Katex object (Use "math" plugin)
147
+ */
148
+ katex?: any | { src: any; options: object };
149
+ /**
150
+ * Math plugin font size list
151
+ */
152
+ mathFontSize?: { text: string; value: string; default?: boolean; }[];
153
+ /**
154
+ * Display
155
+ * =======
156
+ */
157
+ /**
158
+ * The position property of editor
159
+ */
160
+ position?: string;
161
+ /**
162
+ * The display property of editor
163
+ */
164
+ display?: string;
165
+ /**
166
+ * Size of background area when activating dialog window ('full'||'local')
167
+ */
168
+ popupDisplay?: 'full' | 'local';
169
+ /**
170
+ * Bottom resizing bar
171
+ * ===================
172
+ */
173
+ /**
174
+ * Show the bottom resizing bar
175
+ */
176
+ resizingBar?: boolean;
177
+ /**
178
+ * Displays the current node structure to resizingBar
179
+ */
180
+ showPathLabel?: boolean;
181
+ /**
182
+ * Enable/disable resize function of bottom resizing bar.
183
+ */
184
+ resizeEnable?: boolean;
185
+ /**
186
+ * A custom HTML selector placing the resizing bar inside.
187
+ The class name of the element must be 'sun-editor'.
188
+ Element or querySelector argument.
189
+ */
190
+ resizingBarContainer?: HTMLElement | string;
191
+ /**
192
+ * Character count
193
+ * ===============
194
+ */
195
+ /**
196
+ * Shows the number of characters in the editor
197
+ */
198
+ charCounter?: boolean;
199
+ /**
200
+ * Defines the calculation method of the "charCounter" option
201
+ */
202
+ charCounterType?: 'char' | 'byte' | 'byte-html';
203
+ /**
204
+ * Text to be displayed in the "charCounter" area of the bottom bar.
205
+ */
206
+ charCounterLabel?: string;
207
+ /**
208
+ * The maximum number of characters allowed to be inserted into the editor
209
+ */
210
+ maxCharCount?: number;
211
+ /**
212
+ * Size
213
+ * ====
214
+ */
215
+ /**
216
+ * The width size of the editor
217
+ */
218
+ width?: string;
219
+ /**
220
+ * The min-width size of the editor
221
+ */
222
+ minWidth?: string;
223
+ /**
224
+ * The max-width size of the editor
225
+ */
226
+ maxWidth?: string;
227
+ /**
228
+ * The height size of the editor
229
+ */
230
+ height?: string;
231
+ /**
232
+ * The min-height size of the editor
233
+ */
234
+ minHeight?: string;
235
+ /**
236
+ * The max-height size of the editor
237
+ */
238
+ maxHeight?: string;
239
+ /**
240
+ * Editing area
241
+ * ===================
242
+ */
243
+ /**
244
+ * Add a "class" to the editing area[.sun-editor-editable]
245
+ */
246
+ className?: string;
247
+ /**
248
+ * You can define the style of the editing area[.sun-editor-editable].
249
+ * It affects the entire editing area.
250
+ * ('z-index', 'position' and 'width' properties apply to the top div.)
251
+ * @example 'font-family: cursive; font-size: 10px;'
252
+ */
253
+ defaultStyle?: string;
254
+ /**
255
+ * Defining menu items
256
+ * ===================
257
+ */
258
+ /**
259
+ * Change default font-family array
260
+ */
261
+ font?: string[];
262
+ /**
263
+ * Change default font-size array
264
+ */
265
+ fontSize?: number[];
266
+ /**
267
+ * The font size unit
268
+ */
269
+ fontSizeUnit?: string;
270
+ /**
271
+ * A list of drop-down options for the 'align' plugin.
272
+ */
273
+ alignItems?: ('left' | 'center' | 'right' | 'justify')[];
274
+ /**
275
+ * Change default formatBlock array
276
+ */
277
+ formats?: FormatTagName[];
278
+ /**
279
+ * Change default color array of color picker
280
+ */
281
+ colorList?: string[];
282
+ /**
283
+ * Line Heights
284
+ */
285
+ lineHeights?: LineHeightsItem[];
286
+ /**
287
+ * Paragraph Styles
288
+ */
289
+ paragraphStyles?: ParagraphStyles;
290
+ /**
291
+ * Text Styles
292
+ */
293
+ textStyles?: TextStyles;
294
+ /**
295
+ * Image
296
+ * =====
297
+ */
298
+ /**
299
+ * Can resize the image
300
+ */
301
+ imageResizing?: boolean;
302
+ /**
303
+ * Choose whether the image height input is visible.
304
+ */
305
+ imageHeightShow?: boolean;
306
+ /**
307
+ * Choose whether the image align radio buttons are visible.
308
+ */
309
+ imageAlignShow?: boolean;
310
+ /**
311
+ * The default width size of the image frame
312
+ */
313
+ imageWidth?: string;
314
+ /**
315
+ * The default height size of the image frame
316
+ */
317
+ imageHeight?: string;
318
+ /**
319
+ * If true, image size can only be scaled by percentage.
320
+ */
321
+ imageSizeOnlyPercentage?: boolean;
322
+ /**
323
+ * It is determined by "imageSizeOnlyPercentage".
324
+ * @pivate
325
+ */
326
+ _videoSizeUnit?: '%' | 'px';
327
+ /**
328
+ * Choose whether to image rotation buttons display.
329
+ * When "imageSizeOnlyPercentage" is "true" or or "imageHeightShow" is "false" the default value is false.
330
+ * If you want the button to be visible, put it a true.
331
+ */
332
+ imageRotation?: boolean;
333
+ /**
334
+ * Choose whether to create a file input tag in the image upload window
335
+ */
336
+ imageFileInput?: boolean;
337
+ /**
338
+ * Choose whether to create a image url input tag in the image upload window
339
+ */
340
+ imageUrlInput?: boolean;
341
+ /**
342
+ * Http Header when uploading images.
343
+ */
344
+ imageUploadHeader?: Record<string, string>;
345
+ /**
346
+ * The image upload to server mapping address
347
+ */
348
+ imageUploadUrl?: string;
349
+ /**
350
+ * The size of the total uploadable images (in bytes)
351
+ */
352
+ imageUploadSizeLimit?: number;
353
+ /**
354
+ * If true, multiple images can be selected.
355
+ */
356
+ imageMultipleFile?: boolean;
357
+ /**
358
+ * Define the "accept" attribute of the input.
359
+ * @example "*" or ".jpg, .png .."
360
+ */
361
+ imageAccept?: string;
362
+ /**
363
+ * Image - image gallery
364
+ * =====
365
+ */
366
+ /**
367
+ * Direct JSON data without making server requests.
368
+ */
369
+ imageGalleryData?: Array<any>;
370
+ /**
371
+ * The url of the image gallery, if you use the image gallery
372
+ */
373
+ imageGalleryUrl?: string;
374
+ /**
375
+ * Http Header when get image gallery.
376
+ */
377
+ imageGalleryHeader?: Record<string, string>;
378
+ /**
379
+ * Video
380
+ * =====
381
+ */
382
+ /**
383
+ * Can resize the video iframe
384
+ */
385
+ videoResizing?: boolean;
386
+ /**
387
+ * Choose whether the video height input is visible.
388
+ */
389
+ videoHeightShow?: boolean;
390
+ /**
391
+ * Choose whether the video align radio buttons are visible.
392
+ */
393
+ videoAlignShow?: boolean;
394
+ /**
395
+ * Choose whether the video ratio options is visible.
396
+ */
397
+ videoRatioShow?: boolean;
398
+ /**
399
+ * The default width size of the video frame
400
+ */
401
+ videoWidth?: string;
402
+ /**
403
+ * The default height size of the video frame
404
+ */
405
+ videoHeight?: string;
406
+ /**
407
+ * If true, video size can only be scaled by percentage.
408
+ */
409
+ videoSizeOnlyPercentage?: boolean;
410
+ /**
411
+ * Choose whether to video rotation buttons display.
412
+ * When "videoSizeOnlyPercentage" is "true" or "videoHeightShow" is "false" the default value is false.
413
+ * If you want the button to be visible, put it a true.
414
+ */
415
+ videoRotation?: boolean;
416
+ /**
417
+ * The default aspect ratio of the video.
418
+ * Up to four decimal places are allowed.
419
+ */
420
+ videoRatio?: number;
421
+ /**
422
+ * Video ratio selection options.
423
+ */
424
+ videoRatioList?: { name: string; value: number }[];
425
+ /**
426
+ * The query string of a YouTube embedded URL
427
+ */
428
+ youtubeQuery?: string;
429
+ /**
430
+ * Choose whether to create a file input tag in the video upload window
431
+ */
432
+ videoFileInput?: boolean;
433
+ /**
434
+ * Choose whether to create a video url input tag in the video upload window
435
+ */
436
+ videoUrlInput?: boolean;
437
+ /**
438
+ * Http Header when uploading videos.
439
+ */
440
+ videoUploadHeader?: Record<string, string>;
441
+ /**
442
+ * The video upload to server mapping address
443
+ */
444
+ videoUploadUrl?: string;
445
+ /**
446
+ * The size of the total uploadable videos (in bytes)
447
+ */
448
+ videoUploadSizeLimit?: number;
449
+ /**
450
+ * If true, multiple videos can be selected.
451
+ */
452
+ videoMultipleFile?: boolean;
453
+ /**
454
+ * Define "Attributes" of the video tag.
455
+ * @example { poster: "http://suneditor.com/docs/loading.gif", autoplay: true }
456
+ */
457
+ videoTagAttrs?: Record<string, string | boolean>;
458
+ /**
459
+ * Define "Attributes" of the iframe tag. (Youtube, Vimeo).
460
+ * @example { style: "border: 2px solid red;" }
461
+ */
462
+ videoIframeAttrs?: Record<string, string | boolean>;
463
+ /**
464
+ * Define the "accept" attribute of the input.
465
+ * "*" or ".mp4, .avi .."
466
+ */
467
+ videoAccept?: string;
468
+ /**
469
+ * Audio
470
+ * =====
471
+ */
472
+ /**
473
+ * The default width size of the audio frame
474
+ */
475
+ audioWidth?: string;
476
+ /**
477
+ * The default height size of the audio frame
478
+ */
479
+ audioHeight?: string;
480
+ /**
481
+ * Choose whether to create a file input tag in the audio upload window
482
+ */
483
+ audioFileInput?: boolean;
484
+ /**
485
+ * Choose whether to create a audio url input tag in the audio upload window
486
+ */
487
+ audioUrlInput?: boolean;
488
+ /**
489
+ * Http Header when uploading audios.
490
+ */
491
+ audioUploadHeader?: Record<string, string>;
492
+ /**
493
+ * The audio upload to server mapping address
494
+ */
495
+ audioUploadUrl?: string;
496
+ /**
497
+ * The size of the total uploadable audios (in bytes)
498
+ */
499
+ audioUploadSizeLimit?: number;
500
+ /**
501
+ * If true, videos images can be selected.
502
+ */
503
+ audioMultipleFile?: boolean;
504
+ /**
505
+ * Define "Attributes" of the audio tag.
506
+ * @example { controlslist: "nodownload", autoplay: true }
507
+ */
508
+ audioTagAttrs?: Record<string, string | boolean>;
509
+ /**
510
+ * Define the "accept" attribute of the input.
511
+ * "*" or ".mp3, .wav .."
512
+ */
513
+ audioAccept?: string;
514
+ /**
515
+ * Table
516
+ * =====
517
+ */
518
+ /**
519
+ * Define position to the table cell controller. ('cell', 'top')
520
+ */
521
+ tableCellControllerPosition?: string;
522
+ /**
523
+ * Link
524
+ * =====
525
+ */
526
+ /**
527
+ * Default checked value of the "Open in new window" checkbox.
528
+ */
529
+ linkTargetNewWindow?: boolean;
530
+ /**
531
+ * Protocol for the links (if link has been added without any protocol this one will be used).
532
+ */
533
+ linkProtocol?: string;
534
+ /**
535
+ * Defines "rel" attribute list of anchor tag.
536
+ */
537
+ linkRel?: string[];
538
+ /**
539
+ * Defines default "rel" attribute list of anchor tag.
540
+ */
541
+ linkRelDefault?: {default?: string; check_new_window?: string; check_bookmark?: string;};
542
+ /**
543
+ * If true, disables the automatic prefixing of the host URL to the value of the link. default: false {Boolean}
544
+ */
545
+ linkNoPrefix?: boolean;
546
+ /*
547
+ * HR
548
+ * =====
549
+ */
550
+ /**
551
+ * Defines the hr items.
552
+ * "class" or "style" must be specified.
553
+ * @example [{name: "solid", class: "__se__xxx", style: "border-style: outset;"}]
554
+ */
555
+ hrItems?: { name: string; class?: string; style?: string }[];
556
+ /**
557
+ * Key actions
558
+ * =====
559
+ */
560
+ /**
561
+ * If true, disables the interaction of the editor and tab key
562
+ */
563
+ tabDisable?: boolean;
564
+ shortcutsDisable?: string[];
565
+ shortcutsHint?: boolean;
566
+ /**
567
+ * Defining save button
568
+ * ====================
569
+ */
570
+ /**
571
+ * Callback functions that is called when the Save button is clicked
572
+ */
573
+ callBackSave?: (contents: string, isChanged: boolean) => void;
574
+ /**
575
+ * Templates Array
576
+ * ===============
577
+ */
578
+ /**
579
+ * Templates array
580
+ */
581
+ templates?: TemplatesItem[];
582
+ /**
583
+ * ETC
584
+ * ===
585
+ */
586
+ /**
587
+ * The placeholder text
588
+ */
589
+ placeholder?: string;
590
+ /**
591
+ * Activate the media[image, video, audio] selection status immediately after inserting the media tag. (default: true)
592
+ */
593
+ mediaAutoSelect?: boolean;
594
+ /**
595
+ * You can redefine icons.
596
+ */
597
+ icons?: Record<string, string>;
598
+
599
+ /**
600
+ * private options
601
+ */
602
+ _printClass?: string;
603
+ __allowedScriptTags?: boolean;
604
+ }
605
+ export type FormatTagName =
606
+ 'p'
607
+ | 'div'
608
+ | 'blockquote'
609
+ | 'pre'
610
+ | 'h1'
611
+ | 'h2'
612
+ | 'h3'
613
+ | 'h4'
614
+ | 'h5'
615
+ | 'h6'
616
+ | { tag: string; name?: string; command: 'replace' | 'range' | 'free'; class: string };
617
+ export type TemplatesItem = { name: string; html: string };
618
+ export type LineHeightsItem = { text: string; value: number };
619
+ export type ParagraphStyles = (string | { name: string; class: string; _class?: string })[];
620
+ export type TextStyles = (string | { name: string; style: string; tag: string; _class?: string })[];
621
+ export type ButtonListItem = any;