suneditor 3.0.0-beta.2 → 3.0.0-beta.20

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 (177) hide show
  1. package/CONTRIBUTING.md +186 -184
  2. package/LICENSE +21 -21
  3. package/README.md +157 -180
  4. package/dist/suneditor.min.css +1 -1
  5. package/dist/suneditor.min.js +1 -1
  6. package/package.json +126 -123
  7. package/src/assets/design/color.css +131 -121
  8. package/src/assets/design/index.css +3 -3
  9. package/src/assets/design/size.css +37 -35
  10. package/src/assets/design/typography.css +37 -37
  11. package/src/assets/icons/defaultIcons.js +247 -232
  12. package/src/assets/suneditor-contents.css +779 -778
  13. package/src/assets/suneditor.css +43 -35
  14. package/src/core/base/eventHandlers/handler_toolbar.js +135 -135
  15. package/src/core/base/eventHandlers/handler_ww_clipboard.js +56 -56
  16. package/src/core/base/eventHandlers/handler_ww_dragDrop.js +115 -113
  17. package/src/core/base/eventHandlers/handler_ww_key_input.js +1200 -1200
  18. package/src/core/base/eventHandlers/handler_ww_mouse.js +194 -194
  19. package/src/core/base/eventManager.js +1550 -1484
  20. package/src/core/base/history.js +355 -355
  21. package/src/core/class/char.js +163 -162
  22. package/src/core/class/component.js +856 -842
  23. package/src/core/class/format.js +3433 -3422
  24. package/src/core/class/html.js +1927 -1890
  25. package/src/core/class/menu.js +357 -346
  26. package/src/core/class/nodeTransform.js +424 -424
  27. package/src/core/class/offset.js +858 -891
  28. package/src/core/class/selection.js +710 -620
  29. package/src/core/class/shortcuts.js +98 -98
  30. package/src/core/class/toolbar.js +438 -430
  31. package/src/core/class/ui.js +424 -422
  32. package/src/core/class/viewer.js +750 -750
  33. package/src/core/editor.js +1810 -1708
  34. package/src/core/section/actives.js +268 -241
  35. package/src/core/section/constructor.js +1348 -1661
  36. package/src/core/section/context.js +102 -102
  37. package/src/core/section/documentType.js +582 -561
  38. package/src/core/section/options.js +367 -0
  39. package/src/core/util/instanceCheck.js +59 -0
  40. package/src/editorInjector/_classes.js +36 -36
  41. package/src/editorInjector/_core.js +92 -92
  42. package/src/editorInjector/index.js +75 -75
  43. package/src/events.js +634 -622
  44. package/src/helper/clipboard.js +59 -59
  45. package/src/helper/converter.js +586 -564
  46. package/src/helper/dom/domCheck.js +304 -304
  47. package/src/helper/dom/domQuery.js +677 -669
  48. package/src/helper/dom/domUtils.js +618 -557
  49. package/src/helper/dom/index.js +12 -12
  50. package/src/helper/env.js +249 -240
  51. package/src/helper/index.js +25 -25
  52. package/src/helper/keyCodeMap.js +183 -183
  53. package/src/helper/numbers.js +72 -72
  54. package/src/helper/unicode.js +47 -47
  55. package/src/langs/ckb.js +231 -231
  56. package/src/langs/cs.js +231 -231
  57. package/src/langs/da.js +231 -231
  58. package/src/langs/de.js +231 -231
  59. package/src/langs/en.js +230 -230
  60. package/src/langs/es.js +231 -231
  61. package/src/langs/fa.js +231 -231
  62. package/src/langs/fr.js +231 -231
  63. package/src/langs/he.js +231 -231
  64. package/src/langs/hu.js +230 -230
  65. package/src/langs/index.js +28 -28
  66. package/src/langs/it.js +231 -231
  67. package/src/langs/ja.js +230 -230
  68. package/src/langs/km.js +230 -230
  69. package/src/langs/ko.js +230 -230
  70. package/src/langs/lv.js +231 -231
  71. package/src/langs/nl.js +231 -231
  72. package/src/langs/pl.js +231 -231
  73. package/src/langs/pt_br.js +231 -231
  74. package/src/langs/ro.js +231 -231
  75. package/src/langs/ru.js +231 -231
  76. package/src/langs/se.js +231 -231
  77. package/src/langs/tr.js +231 -231
  78. package/src/langs/uk.js +231 -231
  79. package/src/langs/ur.js +231 -231
  80. package/src/langs/zh_cn.js +231 -231
  81. package/src/modules/ApiManager.js +191 -191
  82. package/src/modules/Browser.js +669 -667
  83. package/src/modules/ColorPicker.js +364 -362
  84. package/src/modules/Controller.js +474 -454
  85. package/src/modules/Figure.js +1620 -1617
  86. package/src/modules/FileManager.js +359 -359
  87. package/src/modules/HueSlider.js +577 -565
  88. package/src/modules/Modal.js +346 -346
  89. package/src/modules/ModalAnchorEditor.js +643 -643
  90. package/src/modules/SelectMenu.js +549 -549
  91. package/src/modules/_DragHandle.js +17 -17
  92. package/src/modules/index.js +14 -14
  93. package/src/plugins/browser/audioGallery.js +83 -83
  94. package/src/plugins/browser/fileBrowser.js +103 -103
  95. package/src/plugins/browser/fileGallery.js +83 -83
  96. package/src/plugins/browser/imageGallery.js +81 -81
  97. package/src/plugins/browser/videoGallery.js +103 -103
  98. package/src/plugins/command/blockquote.js +61 -60
  99. package/src/plugins/command/exportPDF.js +134 -134
  100. package/src/plugins/command/fileUpload.js +456 -456
  101. package/src/plugins/command/list_bulleted.js +149 -148
  102. package/src/plugins/command/list_numbered.js +152 -151
  103. package/src/plugins/dropdown/align.js +157 -155
  104. package/src/plugins/dropdown/backgroundColor.js +108 -104
  105. package/src/plugins/dropdown/font.js +141 -137
  106. package/src/plugins/dropdown/fontColor.js +109 -105
  107. package/src/plugins/dropdown/formatBlock.js +170 -178
  108. package/src/plugins/dropdown/hr.js +152 -152
  109. package/src/plugins/dropdown/layout.js +83 -83
  110. package/src/plugins/dropdown/lineHeight.js +131 -130
  111. package/src/plugins/dropdown/list.js +123 -122
  112. package/src/plugins/dropdown/paragraphStyle.js +138 -138
  113. package/src/plugins/dropdown/table.js +4110 -4000
  114. package/src/plugins/dropdown/template.js +83 -83
  115. package/src/plugins/dropdown/textStyle.js +149 -149
  116. package/src/plugins/field/mention.js +242 -242
  117. package/src/plugins/index.js +120 -120
  118. package/src/plugins/input/fontSize.js +414 -410
  119. package/src/plugins/input/pageNavigator.js +71 -70
  120. package/src/plugins/modal/audio.js +677 -677
  121. package/src/plugins/modal/drawing.js +537 -531
  122. package/src/plugins/modal/embed.js +886 -886
  123. package/src/plugins/modal/image.js +1377 -1376
  124. package/src/plugins/modal/link.js +248 -240
  125. package/src/plugins/modal/math.js +563 -563
  126. package/src/plugins/modal/video.js +1226 -1226
  127. package/src/plugins/popup/anchor.js +224 -222
  128. package/src/suneditor.js +114 -107
  129. package/src/themes/dark.css +132 -122
  130. package/src/typedef.js +132 -130
  131. package/types/assets/icons/defaultIcons.d.ts +8 -0
  132. package/types/core/base/eventManager.d.ts +29 -4
  133. package/types/core/class/char.d.ts +2 -1
  134. package/types/core/class/component.d.ts +1 -2
  135. package/types/core/class/format.d.ts +8 -1
  136. package/types/core/class/html.d.ts +8 -0
  137. package/types/core/class/menu.d.ts +8 -0
  138. package/types/core/class/offset.d.ts +24 -26
  139. package/types/core/class/selection.d.ts +2 -0
  140. package/types/core/class/toolbar.d.ts +6 -0
  141. package/types/core/class/ui.d.ts +1 -1
  142. package/types/core/editor.d.ts +34 -12
  143. package/types/core/section/constructor.d.ts +5 -638
  144. package/types/core/section/documentType.d.ts +12 -2
  145. package/types/core/section/options.d.ts +740 -0
  146. package/types/core/util/instanceCheck.d.ts +50 -0
  147. package/types/editorInjector/_core.d.ts +5 -5
  148. package/types/editorInjector/index.d.ts +2 -2
  149. package/types/events.d.ts +2 -0
  150. package/types/helper/converter.d.ts +9 -0
  151. package/types/helper/dom/domQuery.d.ts +5 -5
  152. package/types/helper/dom/domUtils.d.ts +8 -0
  153. package/types/helper/env.d.ts +6 -1
  154. package/types/helper/index.d.ts +4 -1
  155. package/types/index.d.ts +122 -120
  156. package/types/langs/_Lang.d.ts +194 -194
  157. package/types/modules/ColorPicker.d.ts +5 -1
  158. package/types/modules/Controller.d.ts +8 -4
  159. package/types/modules/Figure.d.ts +2 -1
  160. package/types/modules/HueSlider.d.ts +4 -1
  161. package/types/modules/SelectMenu.d.ts +1 -1
  162. package/types/plugins/command/blockquote.d.ts +1 -0
  163. package/types/plugins/command/list_bulleted.d.ts +1 -0
  164. package/types/plugins/command/list_numbered.d.ts +1 -0
  165. package/types/plugins/dropdown/align.d.ts +1 -0
  166. package/types/plugins/dropdown/backgroundColor.d.ts +1 -0
  167. package/types/plugins/dropdown/font.d.ts +1 -0
  168. package/types/plugins/dropdown/fontColor.d.ts +1 -0
  169. package/types/plugins/dropdown/formatBlock.d.ts +3 -2
  170. package/types/plugins/dropdown/lineHeight.d.ts +1 -0
  171. package/types/plugins/dropdown/list.d.ts +1 -0
  172. package/types/plugins/dropdown/table.d.ts +6 -0
  173. package/types/plugins/input/fontSize.d.ts +1 -0
  174. package/types/plugins/modal/drawing.d.ts +4 -0
  175. package/types/plugins/modal/link.d.ts +32 -15
  176. package/types/suneditor.d.ts +13 -9
  177. package/types/typedef.d.ts +8 -0
package/src/events.js CHANGED
@@ -1,622 +1,634 @@
1
- // Event function collection
2
- // This is a collection of functions that can be used in the editor's event callback.
3
- // ---------
4
-
5
- /**
6
- * @typedef {import('./modules/Controller').default} ControllerInstance
7
- */
8
-
9
- // --- native events
10
- /**
11
- * @typedef {Object} BaseEvent
12
- * @property {__se__EditorCore} editor - The root editor instance
13
- * @property {__se__FrameContext} frameContext - frame context
14
- * @property {Event} event - event object
15
- */
16
-
17
- /**
18
- * @typedef {Object} ClipboardEvent
19
- * @property {__se__EditorCore} editor - The root editor instance
20
- * @property {__se__FrameContext} frameContext - frame context
21
- * @property {Event} event - event object
22
- * @property {string} data - drop data
23
- * @property {boolean} maxCharCount - is max char count
24
- * @property {string} from - "SE"|"MS"|"" - source
25
- */
26
-
27
- // --- controller
28
- /**
29
- * @typedef {import('./modules/Controller').ControllerInfo} ControllerInfo_events
30
- */
31
-
32
- // --- media
33
- /**
34
- * @typedef {Object} FileManagementInfo
35
- * @property {string} src - source URL of the image.
36
- * @property {number} index - index of the image.
37
- * @property {string} name - name of the file.
38
- * @property {number} size - size of the file in bytes.
39
- * @property {HTMLElement} element - target element.
40
- * @property {() => void} delete - delete function.
41
- * @property {() => void} select - select function.
42
- */
43
-
44
- /**
45
- * @typedef {Object} ProcessInfo
46
- * @property {string} origin - origin url
47
- * @property {string} url - url
48
- * @property {"video"|"iframe"} tag - tag name
49
- * @property {?HTMLCollection} children - embed children tags
50
- */
51
-
52
- // --- image
53
- /**
54
- * @typedef {Object} ImageInfo
55
- * @property {FileList} files - FileList object
56
- * @property {HTMLImageElement} element - target element
57
- * @property {string} inputWidth - width value
58
- * @property {string} inputHeight - height value
59
- * @property {string} align - align value
60
- * @property {boolean} isUpdate - new create or update
61
- * @property {?HTMLElement} anchor - Anchor element, if it exists
62
- * @property {string} alt - alt text value
63
- */
64
-
65
- // --- video
66
- /**
67
- * @typedef {Object} VideoInfo
68
- * @property {FileList} files - FileList object
69
- * @property {HTMLIFrameElement|HTMLVideoElement} element - target element
70
- * @property {string} inputWidth - width value
71
- * @property {string} inputHeight - height value
72
- * @property {string} align - align value
73
- * @property {boolean} isUpdate - new create or update
74
- * @property {string} url - video url
75
- * @property {?ProcessInfo} process - video process info
76
- */
77
-
78
- // --- audio
79
- /**
80
- * @typedef {Object} AudioInfo
81
- * @property {HTMLAudioElement} element - target element
82
- * @property {FileList} files - FileList object
83
- * @property {boolean} isUpdate - new create or update
84
- */
85
-
86
- // --- file
87
- /**
88
- * @typedef {Object} FileInfo
89
- * @property {string} url - file url
90
- * @property {FileList} files - FileList object
91
- * @property {Object} uploadHeaders - upload headers
92
- */
93
-
94
- // --- embed
95
- /**
96
- * @typedef {Object} EmbedInfo
97
- * @property {HTMLElement} element - target element
98
- * @property {string} inputWidth - width value
99
- * @property {string} inputHeight - height value
100
- * @property {string} align - align value
101
- * @property {boolean} isUpdate - new create or update
102
- * @property {string} url - embed url
103
- * @property {?HTMLElement} children - When the input source is stacked in an iframe, etc., the actual embedded DOM
104
- * @property {?ProcessInfo} process - embed process info
105
- */
106
-
107
- // event function collection
108
- export default {
109
- /**
110
- * @description Event call back function
111
- * @param {Object} params
112
- * @param {__se__EditorCore} params.editor - The root editor instance
113
- */
114
- onload: null,
115
-
116
- /**
117
- * @description Event call back function
118
- * @param {BaseEvent} params
119
- */
120
- onScroll: null,
121
-
122
- /**
123
- * @description Event call back function
124
- * @param {BaseEvent} params
125
- */
126
- onMouseDown: null,
127
-
128
- /**
129
- * @description Event call back function
130
- * @param {BaseEvent} params
131
- */
132
- onClick: null,
133
-
134
- /**
135
- * @description Event call back function
136
- * @param {BaseEvent} params
137
- */
138
- onInput: null,
139
-
140
- /**
141
- * @description Event call back function
142
- * @param {BaseEvent} params
143
- */
144
- onMouseLeave: null,
145
-
146
- /**
147
- * @description Event call back function
148
- * @param {BaseEvent} params
149
- */
150
- onKeyDown: null,
151
-
152
- /**
153
- * @description Event call back function
154
- * @param {BaseEvent} params
155
- */
156
- onKeyUp: null,
157
-
158
- /**
159
- * @description Event call back function
160
- * @param {BaseEvent} params
161
- */
162
- onFocus: null,
163
-
164
- /**
165
- * @description Event call back function
166
- * @param {BaseEvent} params
167
- */
168
- onBlur: null,
169
-
170
- /**
171
- * @description Event function on copy
172
- * @param {Object} params
173
- * @param {__se__EditorCore} params.editor - The root editor instance
174
- * @param {__se__FrameContext} params.frameContext - frame context
175
- * @param {Event} params.event - event object
176
- * @param {Event} params.clipboardData - clipboardData
177
- */
178
- onCopy: null,
179
-
180
- /**
181
- * @description Event function on cut
182
- * @param {Object} params
183
- * @param {__se__EditorCore} params.editor - The root editor instance
184
- * @param {__se__FrameContext} params.frameContext - frame context
185
- * @param {Event} params.event - event object
186
- * @param {Event} params.clipboardData - clipboardData
187
- */
188
- onCut: null,
189
-
190
- /**
191
- * @description Event call back function
192
- * @param {Object} params
193
- * @param {__se__EditorCore} params.editor - The root editor instance
194
- * @param {__se__FrameContext} params.frameContext - frame context
195
- * @param {Event} params.event - event object
196
- * @param {Event} params.data - editor data
197
- */
198
- onChange: null,
199
-
200
- /**
201
- * @description Called just before the inline toolbar is positioned and displayed on the screen.
202
- * @param {HTMLElement} toolbar - Toolbar element
203
- * @param {string} mode - Toolbar mode
204
- */
205
- onShowToolbar: null,
206
-
207
- /**
208
- * @description Called just after the controller is positioned and displayed on the screen.
209
- * - controller : editing elements displayed on the screen [image resizing, table editor, link editor..]]
210
- * @param {Object} params
211
- * @param {__se__EditorCore} params.editor - The root editor instance
212
- * @param {__se__FrameContext} params.frameContext - frame context
213
- * @param {string} params.caller - caller plugin name
214
- * @param {ControllerInfo_events} params.info - info object
215
- */
216
- onShowController: null,
217
-
218
- /**
219
- * @description Called just after the controller is positioned and displayed on the screen.
220
- * - controller : editing elements displayed on the screen [image resizing, table editor, link editor..]]
221
- * @param {Object} params
222
- * @param {__se__EditorCore} params.editor - The root editor instance
223
- * @param {__se__FrameContext} params.frameContext - frame context
224
- * @param {string} params.caller - caller plugin name
225
- * @param {ControllerInfo_events} params.info - info object
226
- */
227
- onBeforeShowController: null,
228
-
229
- /**
230
- * @description An event when toggling between code view and wysiwyg view.
231
- * @param {Object} params
232
- * @param {__se__EditorCore} params.editor - The root editor instance
233
- * @param {__se__FrameContext} params.frameContext - frame context
234
- * @param {boolean} params.is - code view status
235
- */
236
- onToggleCodeView: null,
237
-
238
- /**
239
- * @description An event when toggling full screen.
240
- * @param {Object} params
241
- * @param {__se__EditorCore} params.editor - The root editor instance
242
- * @param {__se__FrameContext} params.frameContext - frame context
243
- * @param {boolean} params.is - full screen status
244
- */
245
- onToggleFullScreen: null,
246
-
247
- /**
248
- * @description Called when the editor is resized using the bottom bar
249
- * @param {Object} params
250
- * @param {__se__EditorCore} params.editor - The root editor instance
251
- * @param {__se__FrameContext} params.frameContext - frame context
252
- * @param {number} params.height - wysiwyg area frame height
253
- * @param {boolean} params.prevHeight - wysiwyg area previous height
254
- * @param {ResizeObserverEntry} params.observerEntry - ResizeObserverEntry
255
- */
256
- onResizeEditor: null,
257
-
258
- /**
259
- * @description Called after the "setToolbarButtons" invocation.
260
- * - Can be used to tweak buttons properties (useful for custom buttons)
261
- * @param {Object} params
262
- * @param {__se__EditorCore} params.editor - The root editor instance
263
- * @param {__se__FrameContext} params.frameContext - frame context
264
- * @param {HTMLElement} params.buttonTray - button tray element
265
- */
266
- onSetToolbarButtons: null,
267
-
268
- /**
269
- * --------------------------------------------------- async function ---------------------------------------------------
270
- */
271
-
272
- /**
273
- * @description Event callback function on save
274
- * @param {Object} params
275
- * @param {__se__EditorCore} params.editor - The root editor instance
276
- * @param {__se__FrameContext} params.frameContext - frame context
277
- * @param {Event} params.data - editor data
278
- * @returns {Promise<boolean>}
279
- */
280
- onSave: null,
281
-
282
- /**
283
- * @description Event function on [drop, paste] before
284
- * - When false is returned, the default behavior is stopped.
285
- * - If the string is returned, the cleanData value is modified to the return value.
286
- * @param {ClipboardEvent} params
287
- * @returns {Promise<boolean|string>}
288
- */
289
- onDrop: null,
290
-
291
- /**
292
- * @description Event function on [drop, paste] before
293
- * - When false is returned, the default behavior is stopped.
294
- * - If the string is returned, the cleanData value is modified to the return value.
295
- * @param {ClipboardEvent} params
296
- * @returns {Promise<boolean|string>}
297
- */
298
- onPaste: null,
299
-
300
- // --- image
301
- /**
302
- * @description It replaces the default callback function of the image upload
303
- * @param {Object} params
304
- * @param {__se__EditorCore} params.editor - The root editor instance
305
- * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
306
- * @param {ImageInfo} params.info - info object
307
- * @returns {Promise<boolean>}
308
- */
309
- imageUploadHandler: null,
310
-
311
- /**
312
- * @description Called before the image is uploaded
313
- * - If true is returned, the internal upload process runs normally.
314
- * - If false is returned, no image upload is performed.
315
- * - If new "info" are returned, replaced the previous "params.info"
316
- * - If undefined is returned, it waits until "uploadHandler" is executed.
317
- * @param {Object} params
318
- * @param {__se__EditorCore} params.editor - The root editor instance
319
- * @param {ImageInfo} params.info - info object
320
- * @param {(newInfo?: ImageInfo|null) => void} params.handler - handler function
321
- * @returns {Promise<boolean|undefined|ImageInfo>}
322
- */
323
- onImageUploadBefore: null,
324
-
325
- /**
326
- * @description Called when the editor loaded, file Current editor value
327
- * @param {Object} params
328
- * @param {__se__EditorCore} params.editor - The root editor instance
329
- * @param {Array<FileManagementInfo>} infoList - info list
330
- */
331
- onImageLoad: null,
332
-
333
- /**
334
- * @description Called when the image is uploaded, updated, deleted
335
- * @param {Object} params
336
- * @param {__se__EditorCore} params.editor - The root editor instance
337
- * @param {FileManagementInfo} params.info - info object
338
- * @param {HTMLElement|null} params.element - target element
339
- * @param {"create"|"update"|"delete"} params.state - state
340
- * @param {number} params.index - data index
341
- * @param {number} params.remainingFilesCount - remaining files count
342
- * @param {string} params.pluginName - plugin name
343
- */
344
- onImageAction: null,
345
-
346
- /**
347
- * @description Called when the image is upload failed
348
- * @param {Object} params
349
- * @param {__se__EditorCore} params.editor - The root editor instance
350
- * @param {string} params.error - error message
351
- * @param {number=} params.limitSize - limit size
352
- * @param {number=} params.uploadSize - upload size
353
- * @param {number=} params.currentSize - current size
354
- * @param {File=} params.file - File object
355
- * @returns {Promise<string|undefined>}
356
- */
357
- onImageUploadError: null,
358
-
359
- /**
360
- * @description Called before the image is deleted
361
- * @param {Object} params
362
- * @param {__se__EditorCore} params.editor - The root editor instance
363
- * @param {HTMLElement} params.element - target element
364
- * @param {HTMLElement} params.container - target's container element (div)
365
- * @param {string} params.align - align value
366
- * @param {string} params.alt - alt text value
367
- * @param {?string} params.url - Anchor url, if it exists
368
- * @returns {Promise<boolean>}
369
- */
370
- onImageDeleteBefore: null,
371
-
372
- // --- video
373
- /**
374
- * @description It replaces the default callback function of the video upload
375
- * @param {Object} params
376
- * @param {__se__EditorCore} params.editor - The root editor instance
377
- * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
378
- * @param {VideoInfo} params.info - info object
379
- * @returns {Promise<boolean>}
380
- */
381
- videoUploadHandler: null,
382
-
383
- /**
384
- * @description Called before the video is uploaded
385
- * - If true is returned, the internal upload process runs normally.
386
- * - If false is returned, no video(iframe, video) upload is performed.
387
- * - If new "info" are returned, replaced the previous "params.info"
388
- * - If undefined is returned, it waits until "uploadHandler" is executed.
389
- * @param {Object} params
390
- * @param {__se__EditorCore} params.editor - The root editor instance
391
- * @param {VideoInfo} params.info - info object
392
- * @param {(newInfo?: VideoInfo|null) => void} params.handler - handler function
393
- * @returns {Promise<boolean|undefined|VideoInfo>}
394
- */
395
- onVideoUploadBefore: null,
396
-
397
- /**
398
- * @description Called when the editor loaded, file Current editor value
399
- * @param {Object} params
400
- * @param {__se__EditorCore} params.editor - The root editor instance
401
- * @param {Array<FileManagementInfo>} infoList - info list
402
- */
403
- onVideoLoad: null,
404
-
405
- /**
406
- * @description Called when the video(iframe, video) is is uploaded, updated, deleted
407
- * @param {Object} params
408
- * @param {__se__EditorCore} params.editor - The root editor instance
409
- * @param {FileManagementInfo} params.info - info object
410
- * @param {HTMLElement|null} params.element - target element
411
- * @param {"create"|"update"|"delete"} params.state - state
412
- * @param {number} params.index - data index
413
- * @param {number} params.remainingFilesCount - remaining files count
414
- * @param {string} params.pluginName - plugin name
415
- */
416
- onVideoAction: null,
417
-
418
- /**
419
- * @description Called when the video(iframe, video) upload failed
420
- * @param {Object} params
421
- * @param {__se__EditorCore} params.editor - The root editor instance
422
- * @param {string} params.error - error message
423
- * @param {number=} params.limitSize - limit size
424
- * @param {number=} params.uploadSize - upload size
425
- * @param {number=} params.currentSize - current size
426
- * @param {File=} params.file - File object
427
- * @returns {Promise<string|undefined>}
428
- */
429
- onVideoUploadError: null,
430
-
431
- /**
432
- * @description Called before the video is deleted
433
- * @param {Object} params
434
- * @param {__se__EditorCore} params.editor - The root editor instance
435
- * @param {HTMLElement} params.element - target element
436
- * @param {HTMLElement} params.container - target's container element (div)
437
- * @param {string} params.align - align value
438
- * @param {string} params.url - video url
439
- * @returns {Promise<boolean>}
440
- */
441
- onVideoDeleteBefore: null,
442
-
443
- /**
444
- * @description It replaces the default callback function of the audio upload
445
- * @param {Object} params
446
- * @param {__se__EditorCore} params.editor - The root editor instance
447
- * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
448
- * @param {AudioInfo} params.info - info object
449
- * @returns {Promise<boolean>}
450
- */
451
- audioUploadHandler: null,
452
-
453
- // --- audio
454
- /**
455
- * @description Called before the audio is uploaded
456
- * - If true is returned, the internal upload process runs normally.
457
- * - If false is returned, no audio upload is performed.
458
- * - If new "info" are returned, replaced the previous "params.info"
459
- * - If undefined is returned, it waits until "uploadHandler" is executed.
460
- * @param {Object} params
461
- * @param {__se__EditorCore} params.editor - The root editor instance
462
- * @param {AudioInfo} params.info - info object
463
- * @param {(newInfo?: AudioInfo|null) => void} params.handler - handler function
464
- * @returns {Promise<boolean|undefined|AudioInfo>}
465
- */
466
- onAudioUploadBefore: null,
467
-
468
- /**
469
- * @description Called when the audio upload failed
470
- * @param {Object} params
471
- * @param {__se__EditorCore} params.editor - The root editor instance
472
- * @param {string} params.error - error message
473
- * @param {number=} params.limitSize - limit size
474
- * @param {number=} params.uploadSize - upload size
475
- * @param {number=} params.currentSize - current size
476
- * @param {File=} params.file - File object
477
- * @returns {Promise<string|undefined>}
478
- */
479
- onAudioUploadError: null,
480
-
481
- /**
482
- * @description Called when the editor loaded, file Current editor value
483
- * @param {Object} params
484
- * @param {__se__EditorCore} params.editor - The root editor instance
485
- * @param {Array<FileManagementInfo>} infoList - info list
486
- */
487
- onAudioLoad: null,
488
-
489
- /**
490
- * @description Called when the audio is is uploaded, updated, deleted
491
- * @param {Object} params
492
- * @param {__se__EditorCore} params.editor - The root editor instance
493
- * @param {FileManagementInfo} params.info - info object
494
- * @param {HTMLElement|null} params.element - target element
495
- * @param {"create"|"update"|"delete"} params.state - state
496
- * @param {number} params.index - data index
497
- * @param {number} params.remainingFilesCount - remaining files count
498
- * @param {string} params.pluginName - plugin name
499
- */
500
- onAudioAction: null,
501
-
502
- /**
503
- * @description Called before the audio is deleted
504
- * @param {Object} params
505
- * @param {__se__EditorCore} params.editor - The root editor instance
506
- * @param {HTMLElement} params.element - target element
507
- * @param {HTMLElement} params.container - target's container element (div)
508
- * @param {string} params.url - audio url
509
- * @returns {Promise<boolean>}
510
- */
511
- onAudioDeleteBefore: null,
512
-
513
- // --- fileUpload
514
- /**
515
- * @description Called when the file is uploaded
516
- * - If true is returned, the internal upload process runs normally.
517
- * - If false is returned, no image upload is performed.
518
- * - If new "info" are returned, replaced the previous "params.info"
519
- * - If undefined is returned, it waits until "uploadHandler" is executed.
520
- * @param {Object} params
521
- * @param {__se__EditorCore} params.editor - The root editor instance
522
- * @param {FileInfo} params.info - info object
523
- * @param {(newInfo?: FileInfo|null) => void} params.handler - handler function
524
- * @returns {Promise<boolean|undefined|AudioInfo>}
525
- */
526
- onFileUploadBefore: null,
527
-
528
- /**
529
- * @description Called when the editor loaded, file Current editor value
530
- * @param {Object} params
531
- * @param {__se__EditorCore} params.editor - The root editor instance
532
- * @param {Array<FileManagementInfo>} infoList - info list
533
- */
534
- onFileLoad: null,
535
-
536
- /**
537
- * @description Called when the file is is uploaded, updated, deleted
538
- * @param {Object} params
539
- * @param {__se__EditorCore} params.editor - The root editor instance
540
- * @param {FileManagementInfo} params.info - info object
541
- * @param {HTMLElement|null} params.element - target element
542
- * @param {"create"|"update"|"delete"} params.state - state
543
- * @param {number} params.index - data index
544
- * @param {number} params.remainingFilesCount - remaining files count
545
- * @param {string} params.pluginName - plugin name
546
- */
547
- onFileAction: null,
548
-
549
- /**
550
- * @description Called when the file is upload failed
551
- * @param {Object} params
552
- * @param {__se__EditorCore} params.editor - The root editor instance
553
- * @param {string} params.error - error message
554
- * @param {number=} params.limitSize - limit size
555
- * @param {number=} params.uploadSize - upload size
556
- * @param {number=} params.currentSize - current size
557
- * @param {File=} params.file - File object
558
- * @returns {Promise<string|undefined>}
559
- */
560
- onFileUploadError: null,
561
-
562
- /**
563
- * @description Called before the file is deleted
564
- * @param {Object} params
565
- * @param {__se__EditorCore} params.editor - The root editor instance
566
- * @param {HTMLElement} params.element - target element
567
- * @param {HTMLElement} params.container - target's container element (div)
568
- * @param {string} params.url - file url
569
- * @returns {Promise<boolean>}
570
- */
571
- onFileDeleteBefore: null,
572
-
573
- // --- exportPDF
574
- /**
575
- * @description Called before the PDF export is started
576
- * @param {Object} params
577
- * @param {__se__EditorCore} params.editor - The root editor instance
578
- * @param {HTMLElement} params.target - wysiwyg editable element
579
- * @returns {Promise<boolean>}
580
- */
581
- onExportPDFBefore: null,
582
-
583
- // --- fileManager
584
- /**
585
- * @description Events that occur when actions such as uploading or deleting all files are performed in the file manager
586
- * @param {Object} params
587
- * @param {__se__EditorCore} params.editor - The root editor instance
588
- * @param {FileManagementInfo} params.info - info object
589
- * @param {HTMLElement|null} params.element - target element
590
- * @param {"create"|"update"|"delete"} params.state - state
591
- * @param {number} params.index - data index
592
- * @param {number} params.remainingFilesCount - remaining files count
593
- * @param {string} params.pluginName - plugin name
594
- */
595
- onFileManagerAction: null,
596
-
597
- // --- embed
598
- /**
599
- * @description Called before the embed is inserted
600
- * - If true is returned, the internal upload process runs normally.
601
- * - If false is returned, no image upload is performed.
602
- * - If new fileList are returned, replaced the previous fileList
603
- * - If undefined is returned, it waits until "uploadHandler" is executed.
604
- * @param {Object} params
605
- * @param {__se__EditorCore} params.editor - The root editor instance
606
- * @param {EmbedInfo} params.info - info object
607
- * @param {(newInfo?: EmbedInfo|null) => void} params.handler - handler function
608
- */
609
- onEmbedInputBefore: null,
610
-
611
- /**
612
- * @description Called before the embed is deleted
613
- * @param {Object} params
614
- * @param {__se__EditorCore} params.editor - The root editor instance
615
- * @param {HTMLElement} params.element - target element
616
- * @param {HTMLElement} params.container - target's container element (div)
617
- * @param {string} params.align - align value
618
- * @param {string} params.url - embed url
619
- * @returns {Promise<boolean>}
620
- */
621
- onEmbedDeleteBefore: null
622
- };
1
+ // Event function collection
2
+ // This is a collection of functions that can be used in the editor's event callback.
3
+ // ---------
4
+
5
+ /**
6
+ * @typedef {import('./modules/Controller').default} ControllerInstance
7
+ */
8
+
9
+ // --- native events
10
+ /**
11
+ * @typedef {Object} BaseEvent
12
+ * @property {__se__EditorCore} editor - The root editor instance
13
+ * @property {__se__FrameContext} frameContext - frame context
14
+ * @property {Event} event - event object
15
+ */
16
+
17
+ /**
18
+ * @typedef {Object} ClipboardEvent
19
+ * @property {__se__EditorCore} editor - The root editor instance
20
+ * @property {__se__FrameContext} frameContext - frame context
21
+ * @property {Event} event - event object
22
+ * @property {string} data - drop data
23
+ * @property {boolean} maxCharCount - is max char count
24
+ * @property {string} from - "SE"|"MS"|"" - source
25
+ */
26
+
27
+ // --- controller
28
+ /**
29
+ * @typedef {import('./modules/Controller').ControllerInfo} ControllerInfo_events
30
+ */
31
+
32
+ // --- media
33
+ /**
34
+ * @typedef {Object} FileManagementInfo
35
+ * @property {string} src - source URL of the image.
36
+ * @property {number} index - index of the image.
37
+ * @property {string} name - name of the file.
38
+ * @property {number} size - size of the file in bytes.
39
+ * @property {HTMLElement} element - target element.
40
+ * @property {() => void} delete - delete function.
41
+ * @property {() => void} select - select function.
42
+ */
43
+
44
+ /**
45
+ * @typedef {Object} ProcessInfo
46
+ * @property {string} origin - origin url
47
+ * @property {string} url - url
48
+ * @property {"video"|"iframe"} tag - tag name
49
+ * @property {?HTMLCollection} children - embed children tags
50
+ */
51
+
52
+ // --- image
53
+ /**
54
+ * @typedef {Object} ImageInfo
55
+ * @property {FileList} files - FileList object
56
+ * @property {HTMLImageElement} element - target element
57
+ * @property {string} inputWidth - width value
58
+ * @property {string} inputHeight - height value
59
+ * @property {string} align - align value
60
+ * @property {boolean} isUpdate - new create or update
61
+ * @property {?HTMLElement} anchor - Anchor element, if it exists
62
+ * @property {string} alt - alt text value
63
+ */
64
+
65
+ // --- video
66
+ /**
67
+ * @typedef {Object} VideoInfo
68
+ * @property {FileList} files - FileList object
69
+ * @property {HTMLIFrameElement|HTMLVideoElement} element - target element
70
+ * @property {string} inputWidth - width value
71
+ * @property {string} inputHeight - height value
72
+ * @property {string} align - align value
73
+ * @property {boolean} isUpdate - new create or update
74
+ * @property {string} url - video url
75
+ * @property {?ProcessInfo} process - video process info
76
+ */
77
+
78
+ // --- audio
79
+ /**
80
+ * @typedef {Object} AudioInfo
81
+ * @property {HTMLAudioElement} element - target element
82
+ * @property {FileList} files - FileList object
83
+ * @property {boolean} isUpdate - new create or update
84
+ */
85
+
86
+ // --- file
87
+ /**
88
+ * @typedef {Object} FileInfo
89
+ * @property {string} url - file url
90
+ * @property {FileList} files - FileList object
91
+ * @property {Object} uploadHeaders - upload headers
92
+ */
93
+
94
+ // --- embed
95
+ /**
96
+ * @typedef {Object} EmbedInfo
97
+ * @property {HTMLElement} element - target element
98
+ * @property {string} inputWidth - width value
99
+ * @property {string} inputHeight - height value
100
+ * @property {string} align - align value
101
+ * @property {boolean} isUpdate - new create or update
102
+ * @property {string} url - embed url
103
+ * @property {?HTMLElement} children - When the input source is stacked in an iframe, etc., the actual embedded DOM
104
+ * @property {?ProcessInfo} process - embed process info
105
+ */
106
+
107
+ // event function collection
108
+ export default {
109
+ /**
110
+ * @description Event call back function
111
+ * @param {Object} params
112
+ * @param {__se__EditorCore} params.editor - The root editor instance
113
+ */
114
+ onload: null,
115
+
116
+ /**
117
+ * @description Event call back function
118
+ * @param {BaseEvent} params
119
+ */
120
+ onScroll: null,
121
+
122
+ /**
123
+ * @description Event call back function
124
+ * @param {BaseEvent} params
125
+ */
126
+ onMouseDown: null,
127
+
128
+ /**
129
+ * @description Event call back function
130
+ * @param {BaseEvent} params
131
+ */
132
+ onClick: null,
133
+
134
+ /**
135
+ * @description Event call back function
136
+ * @param {BaseEvent} params
137
+ */
138
+ onInput: null,
139
+
140
+ /**
141
+ * @description Event call back function
142
+ * @param {BaseEvent} params
143
+ */
144
+ onMouseLeave: null,
145
+
146
+ /**
147
+ * @description Event call back function
148
+ * @param {BaseEvent} params
149
+ */
150
+ onKeyDown: null,
151
+
152
+ /**
153
+ * @description Event call back function
154
+ * @param {BaseEvent} params
155
+ */
156
+ onKeyUp: null,
157
+
158
+ /**
159
+ * @description Event call back function
160
+ * @param {BaseEvent} params
161
+ */
162
+ onFocus: null,
163
+
164
+ /**
165
+ * @description Event call back function
166
+ * @param {BaseEvent} params
167
+ */
168
+ onNativeFocus: null,
169
+
170
+ /**
171
+ * @description Event call back function
172
+ * @param {BaseEvent} params
173
+ */
174
+ onBlur: null,
175
+
176
+ /**
177
+ * @description Event call back function
178
+ * @param {BaseEvent} params
179
+ */
180
+ onNativeBlur: null,
181
+
182
+ /**
183
+ * @description Event function on copy
184
+ * @param {Object} params
185
+ * @param {__se__EditorCore} params.editor - The root editor instance
186
+ * @param {__se__FrameContext} params.frameContext - frame context
187
+ * @param {Event} params.event - event object
188
+ * @param {Event} params.clipboardData - clipboardData
189
+ */
190
+ onCopy: null,
191
+
192
+ /**
193
+ * @description Event function on cut
194
+ * @param {Object} params
195
+ * @param {__se__EditorCore} params.editor - The root editor instance
196
+ * @param {__se__FrameContext} params.frameContext - frame context
197
+ * @param {Event} params.event - event object
198
+ * @param {Event} params.clipboardData - clipboardData
199
+ */
200
+ onCut: null,
201
+
202
+ /**
203
+ * @description Event call back function
204
+ * @param {Object} params
205
+ * @param {__se__EditorCore} params.editor - The root editor instance
206
+ * @param {__se__FrameContext} params.frameContext - frame context
207
+ * @param {Event} params.event - event object
208
+ * @param {Event} params.data - editor data
209
+ */
210
+ onChange: null,
211
+
212
+ /**
213
+ * @description Called just before the inline toolbar is positioned and displayed on the screen.
214
+ * @param {HTMLElement} toolbar - Toolbar element
215
+ * @param {string} mode - Toolbar mode
216
+ */
217
+ onShowToolbar: null,
218
+
219
+ /**
220
+ * @description Called just after the controller is positioned and displayed on the screen.
221
+ * - controller : editing elements displayed on the screen [image resizing, table editor, link editor..]]
222
+ * @param {Object} params
223
+ * @param {__se__EditorCore} params.editor - The root editor instance
224
+ * @param {__se__FrameContext} params.frameContext - frame context
225
+ * @param {string} params.caller - caller plugin name
226
+ * @param {ControllerInfo_events} params.info - info object
227
+ */
228
+ onShowController: null,
229
+
230
+ /**
231
+ * @description Called just after the controller is positioned and displayed on the screen.
232
+ * - controller : editing elements displayed on the screen [image resizing, table editor, link editor..]]
233
+ * @param {Object} params
234
+ * @param {__se__EditorCore} params.editor - The root editor instance
235
+ * @param {__se__FrameContext} params.frameContext - frame context
236
+ * @param {string} params.caller - caller plugin name
237
+ * @param {ControllerInfo_events} params.info - info object
238
+ */
239
+ onBeforeShowController: null,
240
+
241
+ /**
242
+ * @description An event when toggling between code view and wysiwyg view.
243
+ * @param {Object} params
244
+ * @param {__se__EditorCore} params.editor - The root editor instance
245
+ * @param {__se__FrameContext} params.frameContext - frame context
246
+ * @param {boolean} params.is - code view status
247
+ */
248
+ onToggleCodeView: null,
249
+
250
+ /**
251
+ * @description An event when toggling full screen.
252
+ * @param {Object} params
253
+ * @param {__se__EditorCore} params.editor - The root editor instance
254
+ * @param {__se__FrameContext} params.frameContext - frame context
255
+ * @param {boolean} params.is - full screen status
256
+ */
257
+ onToggleFullScreen: null,
258
+
259
+ /**
260
+ * @description Called when the editor is resized using the bottom bar
261
+ * @param {Object} params
262
+ * @param {__se__EditorCore} params.editor - The root editor instance
263
+ * @param {__se__FrameContext} params.frameContext - frame context
264
+ * @param {number} params.height - wysiwyg area frame height
265
+ * @param {boolean} params.prevHeight - wysiwyg area previous height
266
+ * @param {ResizeObserverEntry} params.observerEntry - ResizeObserverEntry
267
+ */
268
+ onResizeEditor: null,
269
+
270
+ /**
271
+ * @description Called after the "setToolbarButtons" invocation.
272
+ * - Can be used to tweak buttons properties (useful for custom buttons)
273
+ * @param {Object} params
274
+ * @param {__se__EditorCore} params.editor - The root editor instance
275
+ * @param {__se__FrameContext} params.frameContext - frame context
276
+ * @param {HTMLElement} params.buttonTray - button tray element
277
+ */
278
+ onSetToolbarButtons: null,
279
+
280
+ /**
281
+ * --------------------------------------------------- async function ---------------------------------------------------
282
+ */
283
+
284
+ /**
285
+ * @description Event callback function on save
286
+ * @param {Object} params
287
+ * @param {__se__EditorCore} params.editor - The root editor instance
288
+ * @param {__se__FrameContext} params.frameContext - frame context
289
+ * @param {Event} params.data - editor data
290
+ * @returns {Promise<boolean>}
291
+ */
292
+ onSave: null,
293
+
294
+ /**
295
+ * @description Event function on [drop, paste] before
296
+ * - When false is returned, the default behavior is stopped.
297
+ * - If the string is returned, the cleanData value is modified to the return value.
298
+ * @param {ClipboardEvent} params
299
+ * @returns {Promise<boolean|string>}
300
+ */
301
+ onDrop: null,
302
+
303
+ /**
304
+ * @description Event function on [drop, paste] before
305
+ * - When false is returned, the default behavior is stopped.
306
+ * - If the string is returned, the cleanData value is modified to the return value.
307
+ * @param {ClipboardEvent} params
308
+ * @returns {Promise<boolean|string>}
309
+ */
310
+ onPaste: null,
311
+
312
+ // --- image
313
+ /**
314
+ * @description It replaces the default callback function of the image upload
315
+ * @param {Object} params
316
+ * @param {__se__EditorCore} params.editor - The root editor instance
317
+ * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
318
+ * @param {ImageInfo} params.info - info object
319
+ * @returns {Promise<boolean>}
320
+ */
321
+ imageUploadHandler: null,
322
+
323
+ /**
324
+ * @description Called before the image is uploaded
325
+ * - If true is returned, the internal upload process runs normally.
326
+ * - If false is returned, no image upload is performed.
327
+ * - If new "info" are returned, replaced the previous "params.info"
328
+ * - If undefined is returned, it waits until "uploadHandler" is executed.
329
+ * @param {Object} params
330
+ * @param {__se__EditorCore} params.editor - The root editor instance
331
+ * @param {ImageInfo} params.info - info object
332
+ * @param {(newInfo?: ImageInfo|null) => void} params.handler - handler function
333
+ * @returns {Promise<boolean|undefined|ImageInfo>}
334
+ */
335
+ onImageUploadBefore: null,
336
+
337
+ /**
338
+ * @description Called when the editor loaded, file Current editor value
339
+ * @param {Object} params
340
+ * @param {__se__EditorCore} params.editor - The root editor instance
341
+ * @param {Array<FileManagementInfo>} infoList - info list
342
+ */
343
+ onImageLoad: null,
344
+
345
+ /**
346
+ * @description Called when the image is uploaded, updated, deleted
347
+ * @param {Object} params
348
+ * @param {__se__EditorCore} params.editor - The root editor instance
349
+ * @param {FileManagementInfo} params.info - info object
350
+ * @param {HTMLElement|null} params.element - target element
351
+ * @param {"create"|"update"|"delete"} params.state - state
352
+ * @param {number} params.index - data index
353
+ * @param {number} params.remainingFilesCount - remaining files count
354
+ * @param {string} params.pluginName - plugin name
355
+ */
356
+ onImageAction: null,
357
+
358
+ /**
359
+ * @description Called when the image is upload failed
360
+ * @param {Object} params
361
+ * @param {__se__EditorCore} params.editor - The root editor instance
362
+ * @param {string} params.error - error message
363
+ * @param {number=} params.limitSize - limit size
364
+ * @param {number=} params.uploadSize - upload size
365
+ * @param {number=} params.currentSize - current size
366
+ * @param {File=} params.file - File object
367
+ * @returns {Promise<string|undefined>}
368
+ */
369
+ onImageUploadError: null,
370
+
371
+ /**
372
+ * @description Called before the image is deleted
373
+ * @param {Object} params
374
+ * @param {__se__EditorCore} params.editor - The root editor instance
375
+ * @param {HTMLElement} params.element - target element
376
+ * @param {HTMLElement} params.container - target's container element (div)
377
+ * @param {string} params.align - align value
378
+ * @param {string} params.alt - alt text value
379
+ * @param {?string} params.url - Anchor url, if it exists
380
+ * @returns {Promise<boolean>}
381
+ */
382
+ onImageDeleteBefore: null,
383
+
384
+ // --- video
385
+ /**
386
+ * @description It replaces the default callback function of the video upload
387
+ * @param {Object} params
388
+ * @param {__se__EditorCore} params.editor - The root editor instance
389
+ * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
390
+ * @param {VideoInfo} params.info - info object
391
+ * @returns {Promise<boolean>}
392
+ */
393
+ videoUploadHandler: null,
394
+
395
+ /**
396
+ * @description Called before the video is uploaded
397
+ * - If true is returned, the internal upload process runs normally.
398
+ * - If false is returned, no video(iframe, video) upload is performed.
399
+ * - If new "info" are returned, replaced the previous "params.info"
400
+ * - If undefined is returned, it waits until "uploadHandler" is executed.
401
+ * @param {Object} params
402
+ * @param {__se__EditorCore} params.editor - The root editor instance
403
+ * @param {VideoInfo} params.info - info object
404
+ * @param {(newInfo?: VideoInfo|null) => void} params.handler - handler function
405
+ * @returns {Promise<boolean|undefined|VideoInfo>}
406
+ */
407
+ onVideoUploadBefore: null,
408
+
409
+ /**
410
+ * @description Called when the editor loaded, file Current editor value
411
+ * @param {Object} params
412
+ * @param {__se__EditorCore} params.editor - The root editor instance
413
+ * @param {Array<FileManagementInfo>} infoList - info list
414
+ */
415
+ onVideoLoad: null,
416
+
417
+ /**
418
+ * @description Called when the video(iframe, video) is is uploaded, updated, deleted
419
+ * @param {Object} params
420
+ * @param {__se__EditorCore} params.editor - The root editor instance
421
+ * @param {FileManagementInfo} params.info - info object
422
+ * @param {HTMLElement|null} params.element - target element
423
+ * @param {"create"|"update"|"delete"} params.state - state
424
+ * @param {number} params.index - data index
425
+ * @param {number} params.remainingFilesCount - remaining files count
426
+ * @param {string} params.pluginName - plugin name
427
+ */
428
+ onVideoAction: null,
429
+
430
+ /**
431
+ * @description Called when the video(iframe, video) upload failed
432
+ * @param {Object} params
433
+ * @param {__se__EditorCore} params.editor - The root editor instance
434
+ * @param {string} params.error - error message
435
+ * @param {number=} params.limitSize - limit size
436
+ * @param {number=} params.uploadSize - upload size
437
+ * @param {number=} params.currentSize - current size
438
+ * @param {File=} params.file - File object
439
+ * @returns {Promise<string|undefined>}
440
+ */
441
+ onVideoUploadError: null,
442
+
443
+ /**
444
+ * @description Called before the video is deleted
445
+ * @param {Object} params
446
+ * @param {__se__EditorCore} params.editor - The root editor instance
447
+ * @param {HTMLElement} params.element - target element
448
+ * @param {HTMLElement} params.container - target's container element (div)
449
+ * @param {string} params.align - align value
450
+ * @param {string} params.url - video url
451
+ * @returns {Promise<boolean>}
452
+ */
453
+ onVideoDeleteBefore: null,
454
+
455
+ /**
456
+ * @description It replaces the default callback function of the audio upload
457
+ * @param {Object} params
458
+ * @param {__se__EditorCore} params.editor - The root editor instance
459
+ * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
460
+ * @param {AudioInfo} params.info - info object
461
+ * @returns {Promise<boolean>}
462
+ */
463
+ audioUploadHandler: null,
464
+
465
+ // --- audio
466
+ /**
467
+ * @description Called before the audio is uploaded
468
+ * - If true is returned, the internal upload process runs normally.
469
+ * - If false is returned, no audio upload is performed.
470
+ * - If new "info" are returned, replaced the previous "params.info"
471
+ * - If undefined is returned, it waits until "uploadHandler" is executed.
472
+ * @param {Object} params
473
+ * @param {__se__EditorCore} params.editor - The root editor instance
474
+ * @param {AudioInfo} params.info - info object
475
+ * @param {(newInfo?: AudioInfo|null) => void} params.handler - handler function
476
+ * @returns {Promise<boolean|undefined|AudioInfo>}
477
+ */
478
+ onAudioUploadBefore: null,
479
+
480
+ /**
481
+ * @description Called when the audio upload failed
482
+ * @param {Object} params
483
+ * @param {__se__EditorCore} params.editor - The root editor instance
484
+ * @param {string} params.error - error message
485
+ * @param {number=} params.limitSize - limit size
486
+ * @param {number=} params.uploadSize - upload size
487
+ * @param {number=} params.currentSize - current size
488
+ * @param {File=} params.file - File object
489
+ * @returns {Promise<string|undefined>}
490
+ */
491
+ onAudioUploadError: null,
492
+
493
+ /**
494
+ * @description Called when the editor loaded, file Current editor value
495
+ * @param {Object} params
496
+ * @param {__se__EditorCore} params.editor - The root editor instance
497
+ * @param {Array<FileManagementInfo>} infoList - info list
498
+ */
499
+ onAudioLoad: null,
500
+
501
+ /**
502
+ * @description Called when the audio is is uploaded, updated, deleted
503
+ * @param {Object} params
504
+ * @param {__se__EditorCore} params.editor - The root editor instance
505
+ * @param {FileManagementInfo} params.info - info object
506
+ * @param {HTMLElement|null} params.element - target element
507
+ * @param {"create"|"update"|"delete"} params.state - state
508
+ * @param {number} params.index - data index
509
+ * @param {number} params.remainingFilesCount - remaining files count
510
+ * @param {string} params.pluginName - plugin name
511
+ */
512
+ onAudioAction: null,
513
+
514
+ /**
515
+ * @description Called before the audio is deleted
516
+ * @param {Object} params
517
+ * @param {__se__EditorCore} params.editor - The root editor instance
518
+ * @param {HTMLElement} params.element - target element
519
+ * @param {HTMLElement} params.container - target's container element (div)
520
+ * @param {string} params.url - audio url
521
+ * @returns {Promise<boolean>}
522
+ */
523
+ onAudioDeleteBefore: null,
524
+
525
+ // --- fileUpload
526
+ /**
527
+ * @description Called when the file is uploaded
528
+ * - If true is returned, the internal upload process runs normally.
529
+ * - If false is returned, no image upload is performed.
530
+ * - If new "info" are returned, replaced the previous "params.info"
531
+ * - If undefined is returned, it waits until "uploadHandler" is executed.
532
+ * @param {Object} params
533
+ * @param {__se__EditorCore} params.editor - The root editor instance
534
+ * @param {FileInfo} params.info - info object
535
+ * @param {(newInfo?: FileInfo|null) => void} params.handler - handler function
536
+ * @returns {Promise<boolean|undefined|AudioInfo>}
537
+ */
538
+ onFileUploadBefore: null,
539
+
540
+ /**
541
+ * @description Called when the editor loaded, file Current editor value
542
+ * @param {Object} params
543
+ * @param {__se__EditorCore} params.editor - The root editor instance
544
+ * @param {Array<FileManagementInfo>} infoList - info list
545
+ */
546
+ onFileLoad: null,
547
+
548
+ /**
549
+ * @description Called when the file is is uploaded, updated, deleted
550
+ * @param {Object} params
551
+ * @param {__se__EditorCore} params.editor - The root editor instance
552
+ * @param {FileManagementInfo} params.info - info object
553
+ * @param {HTMLElement|null} params.element - target element
554
+ * @param {"create"|"update"|"delete"} params.state - state
555
+ * @param {number} params.index - data index
556
+ * @param {number} params.remainingFilesCount - remaining files count
557
+ * @param {string} params.pluginName - plugin name
558
+ */
559
+ onFileAction: null,
560
+
561
+ /**
562
+ * @description Called when the file is upload failed
563
+ * @param {Object} params
564
+ * @param {__se__EditorCore} params.editor - The root editor instance
565
+ * @param {string} params.error - error message
566
+ * @param {number=} params.limitSize - limit size
567
+ * @param {number=} params.uploadSize - upload size
568
+ * @param {number=} params.currentSize - current size
569
+ * @param {File=} params.file - File object
570
+ * @returns {Promise<string|undefined>}
571
+ */
572
+ onFileUploadError: null,
573
+
574
+ /**
575
+ * @description Called before the file is deleted
576
+ * @param {Object} params
577
+ * @param {__se__EditorCore} params.editor - The root editor instance
578
+ * @param {HTMLElement} params.element - target element
579
+ * @param {HTMLElement} params.container - target's container element (div)
580
+ * @param {string} params.url - file url
581
+ * @returns {Promise<boolean>}
582
+ */
583
+ onFileDeleteBefore: null,
584
+
585
+ // --- exportPDF
586
+ /**
587
+ * @description Called before the PDF export is started
588
+ * @param {Object} params
589
+ * @param {__se__EditorCore} params.editor - The root editor instance
590
+ * @param {HTMLElement} params.target - wysiwyg editable element
591
+ * @returns {Promise<boolean>}
592
+ */
593
+ onExportPDFBefore: null,
594
+
595
+ // --- fileManager
596
+ /**
597
+ * @description Events that occur when actions such as uploading or deleting all files are performed in the file manager
598
+ * @param {Object} params
599
+ * @param {__se__EditorCore} params.editor - The root editor instance
600
+ * @param {FileManagementInfo} params.info - info object
601
+ * @param {HTMLElement|null} params.element - target element
602
+ * @param {"create"|"update"|"delete"} params.state - state
603
+ * @param {number} params.index - data index
604
+ * @param {number} params.remainingFilesCount - remaining files count
605
+ * @param {string} params.pluginName - plugin name
606
+ */
607
+ onFileManagerAction: null,
608
+
609
+ // --- embed
610
+ /**
611
+ * @description Called before the embed is inserted
612
+ * - If true is returned, the internal upload process runs normally.
613
+ * - If false is returned, no image upload is performed.
614
+ * - If new fileList are returned, replaced the previous fileList
615
+ * - If undefined is returned, it waits until "uploadHandler" is executed.
616
+ * @param {Object} params
617
+ * @param {__se__EditorCore} params.editor - The root editor instance
618
+ * @param {EmbedInfo} params.info - info object
619
+ * @param {(newInfo?: EmbedInfo|null) => void} params.handler - handler function
620
+ */
621
+ onEmbedInputBefore: null,
622
+
623
+ /**
624
+ * @description Called before the embed is deleted
625
+ * @param {Object} params
626
+ * @param {__se__EditorCore} params.editor - The root editor instance
627
+ * @param {HTMLElement} params.element - target element
628
+ * @param {HTMLElement} params.container - target's container element (div)
629
+ * @param {string} params.align - align value
630
+ * @param {string} params.url - embed url
631
+ * @returns {Promise<boolean>}
632
+ */
633
+ onEmbedDeleteBefore: null
634
+ };