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.
- package/CONTRIBUTING.md +186 -184
- package/LICENSE +21 -21
- package/README.md +157 -180
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +126 -123
- package/src/assets/design/color.css +131 -121
- package/src/assets/design/index.css +3 -3
- package/src/assets/design/size.css +37 -35
- package/src/assets/design/typography.css +37 -37
- package/src/assets/icons/defaultIcons.js +247 -232
- package/src/assets/suneditor-contents.css +779 -778
- package/src/assets/suneditor.css +43 -35
- package/src/core/base/eventHandlers/handler_toolbar.js +135 -135
- package/src/core/base/eventHandlers/handler_ww_clipboard.js +56 -56
- package/src/core/base/eventHandlers/handler_ww_dragDrop.js +115 -113
- package/src/core/base/eventHandlers/handler_ww_key_input.js +1200 -1200
- package/src/core/base/eventHandlers/handler_ww_mouse.js +194 -194
- package/src/core/base/eventManager.js +1550 -1484
- package/src/core/base/history.js +355 -355
- package/src/core/class/char.js +163 -162
- package/src/core/class/component.js +856 -842
- package/src/core/class/format.js +3433 -3422
- package/src/core/class/html.js +1927 -1890
- package/src/core/class/menu.js +357 -346
- package/src/core/class/nodeTransform.js +424 -424
- package/src/core/class/offset.js +858 -891
- package/src/core/class/selection.js +710 -620
- package/src/core/class/shortcuts.js +98 -98
- package/src/core/class/toolbar.js +438 -430
- package/src/core/class/ui.js +424 -422
- package/src/core/class/viewer.js +750 -750
- package/src/core/editor.js +1810 -1708
- package/src/core/section/actives.js +268 -241
- package/src/core/section/constructor.js +1348 -1661
- package/src/core/section/context.js +102 -102
- package/src/core/section/documentType.js +582 -561
- package/src/core/section/options.js +367 -0
- package/src/core/util/instanceCheck.js +59 -0
- package/src/editorInjector/_classes.js +36 -36
- package/src/editorInjector/_core.js +92 -92
- package/src/editorInjector/index.js +75 -75
- package/src/events.js +634 -622
- package/src/helper/clipboard.js +59 -59
- package/src/helper/converter.js +586 -564
- package/src/helper/dom/domCheck.js +304 -304
- package/src/helper/dom/domQuery.js +677 -669
- package/src/helper/dom/domUtils.js +618 -557
- package/src/helper/dom/index.js +12 -12
- package/src/helper/env.js +249 -240
- package/src/helper/index.js +25 -25
- package/src/helper/keyCodeMap.js +183 -183
- package/src/helper/numbers.js +72 -72
- package/src/helper/unicode.js +47 -47
- package/src/langs/ckb.js +231 -231
- package/src/langs/cs.js +231 -231
- package/src/langs/da.js +231 -231
- package/src/langs/de.js +231 -231
- package/src/langs/en.js +230 -230
- package/src/langs/es.js +231 -231
- package/src/langs/fa.js +231 -231
- package/src/langs/fr.js +231 -231
- package/src/langs/he.js +231 -231
- package/src/langs/hu.js +230 -230
- package/src/langs/index.js +28 -28
- package/src/langs/it.js +231 -231
- package/src/langs/ja.js +230 -230
- package/src/langs/km.js +230 -230
- package/src/langs/ko.js +230 -230
- package/src/langs/lv.js +231 -231
- package/src/langs/nl.js +231 -231
- package/src/langs/pl.js +231 -231
- package/src/langs/pt_br.js +231 -231
- package/src/langs/ro.js +231 -231
- package/src/langs/ru.js +231 -231
- package/src/langs/se.js +231 -231
- package/src/langs/tr.js +231 -231
- package/src/langs/uk.js +231 -231
- package/src/langs/ur.js +231 -231
- package/src/langs/zh_cn.js +231 -231
- package/src/modules/ApiManager.js +191 -191
- package/src/modules/Browser.js +669 -667
- package/src/modules/ColorPicker.js +364 -362
- package/src/modules/Controller.js +474 -454
- package/src/modules/Figure.js +1620 -1617
- package/src/modules/FileManager.js +359 -359
- package/src/modules/HueSlider.js +577 -565
- package/src/modules/Modal.js +346 -346
- package/src/modules/ModalAnchorEditor.js +643 -643
- package/src/modules/SelectMenu.js +549 -549
- package/src/modules/_DragHandle.js +17 -17
- package/src/modules/index.js +14 -14
- package/src/plugins/browser/audioGallery.js +83 -83
- package/src/plugins/browser/fileBrowser.js +103 -103
- package/src/plugins/browser/fileGallery.js +83 -83
- package/src/plugins/browser/imageGallery.js +81 -81
- package/src/plugins/browser/videoGallery.js +103 -103
- package/src/plugins/command/blockquote.js +61 -60
- package/src/plugins/command/exportPDF.js +134 -134
- package/src/plugins/command/fileUpload.js +456 -456
- package/src/plugins/command/list_bulleted.js +149 -148
- package/src/plugins/command/list_numbered.js +152 -151
- package/src/plugins/dropdown/align.js +157 -155
- package/src/plugins/dropdown/backgroundColor.js +108 -104
- package/src/plugins/dropdown/font.js +141 -137
- package/src/plugins/dropdown/fontColor.js +109 -105
- package/src/plugins/dropdown/formatBlock.js +170 -178
- package/src/plugins/dropdown/hr.js +152 -152
- package/src/plugins/dropdown/layout.js +83 -83
- package/src/plugins/dropdown/lineHeight.js +131 -130
- package/src/plugins/dropdown/list.js +123 -122
- package/src/plugins/dropdown/paragraphStyle.js +138 -138
- package/src/plugins/dropdown/table.js +4110 -4000
- package/src/plugins/dropdown/template.js +83 -83
- package/src/plugins/dropdown/textStyle.js +149 -149
- package/src/plugins/field/mention.js +242 -242
- package/src/plugins/index.js +120 -120
- package/src/plugins/input/fontSize.js +414 -410
- package/src/plugins/input/pageNavigator.js +71 -70
- package/src/plugins/modal/audio.js +677 -677
- package/src/plugins/modal/drawing.js +537 -531
- package/src/plugins/modal/embed.js +886 -886
- package/src/plugins/modal/image.js +1377 -1376
- package/src/plugins/modal/link.js +248 -240
- package/src/plugins/modal/math.js +563 -563
- package/src/plugins/modal/video.js +1226 -1226
- package/src/plugins/popup/anchor.js +224 -222
- package/src/suneditor.js +114 -107
- package/src/themes/dark.css +132 -122
- package/src/typedef.js +132 -130
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/core/base/eventManager.d.ts +29 -4
- package/types/core/class/char.d.ts +2 -1
- package/types/core/class/component.d.ts +1 -2
- package/types/core/class/format.d.ts +8 -1
- package/types/core/class/html.d.ts +8 -0
- package/types/core/class/menu.d.ts +8 -0
- package/types/core/class/offset.d.ts +24 -26
- package/types/core/class/selection.d.ts +2 -0
- package/types/core/class/toolbar.d.ts +6 -0
- package/types/core/class/ui.d.ts +1 -1
- package/types/core/editor.d.ts +34 -12
- package/types/core/section/constructor.d.ts +5 -638
- package/types/core/section/documentType.d.ts +12 -2
- package/types/core/section/options.d.ts +740 -0
- package/types/core/util/instanceCheck.d.ts +50 -0
- package/types/editorInjector/_core.d.ts +5 -5
- package/types/editorInjector/index.d.ts +2 -2
- package/types/events.d.ts +2 -0
- package/types/helper/converter.d.ts +9 -0
- package/types/helper/dom/domQuery.d.ts +5 -5
- package/types/helper/dom/domUtils.d.ts +8 -0
- package/types/helper/env.d.ts +6 -1
- package/types/helper/index.d.ts +4 -1
- package/types/index.d.ts +122 -120
- package/types/langs/_Lang.d.ts +194 -194
- package/types/modules/ColorPicker.d.ts +5 -1
- package/types/modules/Controller.d.ts +8 -4
- package/types/modules/Figure.d.ts +2 -1
- package/types/modules/HueSlider.d.ts +4 -1
- package/types/modules/SelectMenu.d.ts +1 -1
- package/types/plugins/command/blockquote.d.ts +1 -0
- package/types/plugins/command/list_bulleted.d.ts +1 -0
- package/types/plugins/command/list_numbered.d.ts +1 -0
- package/types/plugins/dropdown/align.d.ts +1 -0
- package/types/plugins/dropdown/backgroundColor.d.ts +1 -0
- package/types/plugins/dropdown/font.d.ts +1 -0
- package/types/plugins/dropdown/fontColor.d.ts +1 -0
- package/types/plugins/dropdown/formatBlock.d.ts +3 -2
- package/types/plugins/dropdown/lineHeight.d.ts +1 -0
- package/types/plugins/dropdown/list.d.ts +1 -0
- package/types/plugins/dropdown/table.d.ts +6 -0
- package/types/plugins/input/fontSize.d.ts +1 -0
- package/types/plugins/modal/drawing.d.ts +4 -0
- package/types/plugins/modal/link.d.ts +32 -15
- package/types/suneditor.d.ts +13 -9
- 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
|
-
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @description Event
|
|
172
|
-
* @param {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
* @
|
|
184
|
-
* @param {
|
|
185
|
-
* @param {
|
|
186
|
-
* @param {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
* @
|
|
194
|
-
* @param {
|
|
195
|
-
* @param {
|
|
196
|
-
* @param {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
* @
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
* @
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
* @
|
|
214
|
-
* @param {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* @param {
|
|
223
|
-
* @param {
|
|
224
|
-
* @param {
|
|
225
|
-
* @param {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
* @
|
|
232
|
-
*
|
|
233
|
-
* @param {
|
|
234
|
-
* @param {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
* @
|
|
243
|
-
* @param {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* @
|
|
252
|
-
* @param {
|
|
253
|
-
* @param {
|
|
254
|
-
* @param {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
*
|
|
261
|
-
* @param {Object} params
|
|
262
|
-
* @param {__se__EditorCore} params.editor - The root editor instance
|
|
263
|
-
* @param {__se__FrameContext} params.frameContext - frame context
|
|
264
|
-
* @param {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
* @
|
|
274
|
-
* @param {
|
|
275
|
-
* @param {
|
|
276
|
-
* @param {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
*
|
|
286
|
-
* @param {
|
|
287
|
-
* @
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
* @
|
|
296
|
-
*
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
* @
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
* @
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* @param {
|
|
318
|
-
* @param {
|
|
319
|
-
* @
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* @param {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
* @
|
|
339
|
-
* @param {
|
|
340
|
-
* @param {
|
|
341
|
-
* @param {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
* @
|
|
348
|
-
* @param {
|
|
349
|
-
* @param {
|
|
350
|
-
* @param {
|
|
351
|
-
* @param {
|
|
352
|
-
* @param {number
|
|
353
|
-
* @param {number
|
|
354
|
-
* @param {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
* @
|
|
361
|
-
* @param {
|
|
362
|
-
* @param {
|
|
363
|
-
* @param {
|
|
364
|
-
* @param {
|
|
365
|
-
* @param {
|
|
366
|
-
* @param {
|
|
367
|
-
* @
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
* @
|
|
375
|
-
* @param {
|
|
376
|
-
* @param {
|
|
377
|
-
* @param {
|
|
378
|
-
* @param {
|
|
379
|
-
* @
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* @param {
|
|
390
|
-
* @param {
|
|
391
|
-
* @
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
* @param {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
* @
|
|
411
|
-
* @param {
|
|
412
|
-
* @param {
|
|
413
|
-
* @param {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
* @
|
|
420
|
-
* @param {
|
|
421
|
-
* @param {
|
|
422
|
-
* @param {
|
|
423
|
-
* @param {
|
|
424
|
-
* @param {number
|
|
425
|
-
* @param {number
|
|
426
|
-
* @param {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
* @
|
|
433
|
-
* @param {
|
|
434
|
-
* @param {
|
|
435
|
-
* @param {
|
|
436
|
-
* @param {
|
|
437
|
-
* @param {
|
|
438
|
-
* @param {
|
|
439
|
-
* @returns {Promise<
|
|
440
|
-
*/
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* @description
|
|
445
|
-
* @param {Object} params
|
|
446
|
-
* @param {__se__EditorCore} params.editor - The root editor instance
|
|
447
|
-
* @param {
|
|
448
|
-
* @param {
|
|
449
|
-
* @
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
* @param {
|
|
461
|
-
* @
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
* @param {
|
|
473
|
-
* @param {
|
|
474
|
-
* @param {
|
|
475
|
-
* @param {
|
|
476
|
-
* @
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
* @
|
|
483
|
-
* @param {
|
|
484
|
-
* @param {
|
|
485
|
-
* @param {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
* @
|
|
495
|
-
* @param {
|
|
496
|
-
* @param {
|
|
497
|
-
* @param {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
* @
|
|
504
|
-
* @param {
|
|
505
|
-
* @param {
|
|
506
|
-
* @param {HTMLElement} params.element - target element
|
|
507
|
-
* @param {
|
|
508
|
-
* @param {
|
|
509
|
-
* @
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* @description Called
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
* @param {
|
|
521
|
-
* @
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
* @param {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
* @
|
|
542
|
-
* @param {
|
|
543
|
-
* @param {
|
|
544
|
-
* @param {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
* @
|
|
551
|
-
* @param {
|
|
552
|
-
* @param {
|
|
553
|
-
* @param {
|
|
554
|
-
* @param {
|
|
555
|
-
* @param {number
|
|
556
|
-
* @param {number
|
|
557
|
-
* @param {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
* @
|
|
564
|
-
* @param {
|
|
565
|
-
* @param {
|
|
566
|
-
* @param {
|
|
567
|
-
* @param {
|
|
568
|
-
* @param {
|
|
569
|
-
* @
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* @description Called before the
|
|
576
|
-
* @param {Object} params
|
|
577
|
-
* @param {__se__EditorCore} params.editor - The root editor instance
|
|
578
|
-
* @param {HTMLElement} params.
|
|
579
|
-
* @
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
* @
|
|
588
|
-
* @param {
|
|
589
|
-
* @param {
|
|
590
|
-
* @param {
|
|
591
|
-
* @
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
* @
|
|
600
|
-
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* @param {
|
|
605
|
-
* @param {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
* @param {
|
|
617
|
-
* @param {
|
|
618
|
-
* @param {
|
|
619
|
-
* @
|
|
620
|
-
*/
|
|
621
|
-
|
|
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
|
+
};
|