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