suneditor 3.0.0-beta.9 → 3.0.0-rc.2

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 (380) hide show
  1. package/README.md +65 -57
  2. package/dist/suneditor-contents.min.css +1 -0
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +110 -61
  6. package/src/assets/design/color.css +36 -17
  7. package/src/assets/design/size.css +2 -0
  8. package/src/assets/icons/defaultIcons.js +17 -2
  9. package/src/assets/suneditor-contents.css +51 -16
  10. package/src/assets/suneditor.css +116 -43
  11. package/src/core/config/contextProvider.js +288 -0
  12. package/src/core/config/eventManager.js +188 -0
  13. package/src/core/config/instanceCheck.js +59 -0
  14. package/src/core/config/optionProvider.js +452 -0
  15. package/src/core/editor.js +166 -1637
  16. package/src/core/event/actions/index.js +229 -0
  17. package/src/core/event/effects/common.registry.js +74 -0
  18. package/src/core/event/effects/keydown.registry.js +573 -0
  19. package/src/core/event/effects/ruleHelpers.js +148 -0
  20. package/src/core/event/eventOrchestrator.js +944 -0
  21. package/src/core/event/executor.js +27 -0
  22. package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +27 -28
  23. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +10 -8
  24. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +22 -23
  25. package/src/core/event/handlers/handler_ww_input.js +75 -0
  26. package/src/core/event/handlers/handler_ww_key.js +228 -0
  27. package/src/core/event/handlers/handler_ww_mouse.js +166 -0
  28. package/src/core/event/ports.js +211 -0
  29. package/src/core/event/reducers/keydown.reducer.js +97 -0
  30. package/src/core/event/rules/keydown.rule.arrow.js +63 -0
  31. package/src/core/event/rules/keydown.rule.backspace.js +208 -0
  32. package/src/core/event/rules/keydown.rule.delete.js +132 -0
  33. package/src/core/event/rules/keydown.rule.enter.js +150 -0
  34. package/src/core/event/rules/keydown.rule.tab.js +35 -0
  35. package/src/core/event/support/defaultLineManager.js +136 -0
  36. package/src/core/event/support/selectionState.js +204 -0
  37. package/src/core/kernel/coreKernel.js +320 -0
  38. package/src/core/kernel/kernelInjector.js +19 -0
  39. package/src/core/kernel/store.js +173 -0
  40. package/src/core/{class → logic/dom}/char.js +42 -45
  41. package/src/core/logic/dom/format.js +1075 -0
  42. package/src/core/{class → logic/dom}/html.js +743 -624
  43. package/src/core/logic/dom/inline.js +1847 -0
  44. package/src/core/logic/dom/listFormat.js +601 -0
  45. package/src/core/{class → logic/dom}/nodeTransform.js +92 -72
  46. package/src/core/{class → logic/dom}/offset.js +254 -317
  47. package/src/core/logic/dom/selection.js +754 -0
  48. package/src/core/logic/panel/menu.js +389 -0
  49. package/src/core/logic/panel/toolbar.js +449 -0
  50. package/src/core/logic/panel/viewer.js +761 -0
  51. package/src/core/logic/shell/_commandExecutor.js +380 -0
  52. package/src/core/logic/shell/commandDispatcher.js +241 -0
  53. package/src/core/logic/shell/component.js +970 -0
  54. package/src/core/logic/shell/focusManager.js +110 -0
  55. package/src/core/{base → logic/shell}/history.js +110 -60
  56. package/src/core/logic/shell/pluginManager.js +363 -0
  57. package/src/core/logic/shell/shortcuts.js +130 -0
  58. package/src/core/logic/shell/ui.js +904 -0
  59. package/src/core/schema/context.js +66 -0
  60. package/src/core/schema/frameContext.js +160 -0
  61. package/src/core/schema/options.js +628 -0
  62. package/src/core/section/constructor.js +194 -500
  63. package/src/core/section/documentType.js +297 -222
  64. package/src/events.js +808 -543
  65. package/src/helper/clipboard.js +27 -16
  66. package/src/helper/converter.js +100 -78
  67. package/src/helper/dom/domCheck.js +56 -30
  68. package/src/helper/dom/domQuery.js +159 -89
  69. package/src/helper/dom/domUtils.js +114 -49
  70. package/src/helper/dom/index.js +5 -1
  71. package/src/helper/env.js +26 -26
  72. package/src/helper/index.js +1 -1
  73. package/src/helper/keyCodeMap.js +25 -28
  74. package/src/helper/numbers.js +4 -8
  75. package/src/helper/unicode.js +4 -8
  76. package/src/hooks/base.js +307 -0
  77. package/src/hooks/params.js +130 -0
  78. package/src/interfaces/contracts.js +227 -0
  79. package/src/interfaces/index.js +7 -0
  80. package/src/interfaces/plugins.js +239 -0
  81. package/src/langs/ckb.js +4 -4
  82. package/src/langs/cs.js +4 -4
  83. package/src/langs/da.js +4 -4
  84. package/src/langs/de.js +4 -4
  85. package/src/langs/en.js +4 -4
  86. package/src/langs/es.js +4 -4
  87. package/src/langs/fa.js +4 -4
  88. package/src/langs/fr.js +4 -4
  89. package/src/langs/he.js +4 -4
  90. package/src/langs/hu.js +4 -4
  91. package/src/langs/it.js +4 -4
  92. package/src/langs/ja.js +4 -4
  93. package/src/langs/km.js +4 -4
  94. package/src/langs/ko.js +4 -4
  95. package/src/langs/lv.js +4 -4
  96. package/src/langs/nl.js +4 -4
  97. package/src/langs/pl.js +4 -4
  98. package/src/langs/pt_br.js +13 -13
  99. package/src/langs/ro.js +4 -4
  100. package/src/langs/ru.js +4 -4
  101. package/src/langs/se.js +4 -4
  102. package/src/langs/tr.js +4 -4
  103. package/src/langs/uk.js +4 -4
  104. package/src/langs/ur.js +4 -4
  105. package/src/langs/zh_cn.js +4 -4
  106. package/src/modules/{Browser.js → contract/Browser.js} +119 -128
  107. package/src/modules/{ColorPicker.js → contract/ColorPicker.js} +132 -142
  108. package/src/modules/contract/Controller.js +589 -0
  109. package/src/modules/{Figure.js → contract/Figure.js} +591 -411
  110. package/src/modules/{HueSlider.js → contract/HueSlider.js} +125 -86
  111. package/src/modules/contract/Modal.js +357 -0
  112. package/src/modules/contract/index.js +9 -0
  113. package/src/modules/manager/ApiManager.js +197 -0
  114. package/src/modules/{FileManager.js → manager/FileManager.js} +128 -160
  115. package/src/modules/manager/index.js +5 -0
  116. package/src/modules/{ModalAnchorEditor.js → ui/ModalAnchorEditor.js} +108 -138
  117. package/src/modules/{SelectMenu.js → ui/SelectMenu.js} +119 -120
  118. package/src/modules/{_DragHandle.js → ui/_DragHandle.js} +1 -1
  119. package/src/modules/ui/index.js +6 -0
  120. package/src/plugins/browser/audioGallery.js +23 -26
  121. package/src/plugins/browser/fileBrowser.js +25 -28
  122. package/src/plugins/browser/fileGallery.js +20 -23
  123. package/src/plugins/browser/imageGallery.js +24 -23
  124. package/src/plugins/browser/videoGallery.js +27 -29
  125. package/src/plugins/command/blockquote.js +11 -17
  126. package/src/plugins/command/exportPDF.js +26 -26
  127. package/src/plugins/command/fileUpload.js +138 -133
  128. package/src/plugins/command/list_bulleted.js +48 -44
  129. package/src/plugins/command/list_numbered.js +48 -44
  130. package/src/plugins/dropdown/align.js +64 -50
  131. package/src/plugins/dropdown/backgroundColor.js +34 -35
  132. package/src/plugins/dropdown/{formatBlock.js → blockStyle.js} +43 -37
  133. package/src/plugins/dropdown/font.js +50 -36
  134. package/src/plugins/dropdown/fontColor.js +34 -35
  135. package/src/plugins/dropdown/hr.js +55 -50
  136. package/src/plugins/dropdown/layout.js +20 -15
  137. package/src/plugins/dropdown/lineHeight.js +46 -30
  138. package/src/plugins/dropdown/list.js +32 -33
  139. package/src/plugins/dropdown/paragraphStyle.js +40 -34
  140. package/src/plugins/dropdown/table/index.js +915 -0
  141. package/src/plugins/dropdown/table/render/table.html.js +308 -0
  142. package/src/plugins/dropdown/table/render/table.menu.js +121 -0
  143. package/src/plugins/dropdown/table/services/table.cell.js +465 -0
  144. package/src/plugins/dropdown/table/services/table.clipboard.js +414 -0
  145. package/src/plugins/dropdown/table/services/table.grid.js +504 -0
  146. package/src/plugins/dropdown/table/services/table.resize.js +463 -0
  147. package/src/plugins/dropdown/table/services/table.selection.js +466 -0
  148. package/src/plugins/dropdown/table/services/table.style.js +844 -0
  149. package/src/plugins/dropdown/table/shared/table.constants.js +109 -0
  150. package/src/plugins/dropdown/table/shared/table.utils.js +219 -0
  151. package/src/plugins/dropdown/template.js +20 -15
  152. package/src/plugins/dropdown/textStyle.js +28 -22
  153. package/src/plugins/field/mention.js +54 -49
  154. package/src/plugins/index.js +5 -5
  155. package/src/plugins/input/fontSize.js +100 -97
  156. package/src/plugins/input/pageNavigator.js +13 -10
  157. package/src/plugins/modal/audio.js +208 -219
  158. package/src/plugins/modal/drawing.js +99 -104
  159. package/src/plugins/modal/embed.js +323 -312
  160. package/src/plugins/modal/image/index.js +942 -0
  161. package/src/plugins/modal/image/render/image.html.js +150 -0
  162. package/src/plugins/modal/image/services/image.size.js +198 -0
  163. package/src/plugins/modal/image/services/image.upload.js +216 -0
  164. package/src/plugins/modal/image/shared/image.constants.js +20 -0
  165. package/src/plugins/modal/link.js +74 -54
  166. package/src/plugins/modal/math.js +126 -119
  167. package/src/plugins/modal/video/index.js +858 -0
  168. package/src/plugins/modal/video/render/video.html.js +131 -0
  169. package/src/plugins/modal/video/services/video.size.js +281 -0
  170. package/src/plugins/modal/video/services/video.upload.js +92 -0
  171. package/src/plugins/popup/anchor.js +57 -49
  172. package/src/suneditor.js +73 -61
  173. package/src/themes/cobalt.css +155 -0
  174. package/src/themes/dark.css +143 -120
  175. package/src/typedef.js +214 -63
  176. package/types/assets/icons/defaultIcons.d.ts +8 -0
  177. package/types/assets/suneditor-contents.css.d.ts +1 -0
  178. package/types/assets/suneditor.css.d.ts +1 -0
  179. package/types/core/config/contextProvider.d.ts +148 -0
  180. package/types/core/config/eventManager.d.ts +68 -0
  181. package/types/core/config/instanceCheck.d.ts +33 -0
  182. package/types/core/config/optionProvider.d.ts +147 -0
  183. package/types/core/editor.d.ts +27 -586
  184. package/types/core/event/actions/index.d.ts +50 -0
  185. package/types/core/event/effects/common.registry.d.ts +56 -0
  186. package/types/core/event/effects/keydown.registry.d.ts +80 -0
  187. package/types/core/event/effects/ruleHelpers.d.ts +36 -0
  188. package/types/core/event/eventOrchestrator.d.ts +191 -0
  189. package/types/core/event/executor.d.ts +13 -0
  190. package/types/core/event/handlers/handler_toolbar.d.ts +38 -0
  191. package/types/core/event/handlers/handler_ww_clipboard.d.ts +36 -0
  192. package/types/core/event/handlers/handler_ww_dragDrop.d.ts +26 -0
  193. package/types/core/event/handlers/handler_ww_input.d.ts +38 -0
  194. package/types/core/event/handlers/handler_ww_key.d.ts +40 -0
  195. package/types/core/event/handlers/handler_ww_mouse.d.ts +47 -0
  196. package/types/core/event/ports.d.ts +256 -0
  197. package/types/core/event/reducers/keydown.reducer.d.ts +84 -0
  198. package/types/core/event/rules/keydown.rule.arrow.d.ts +19 -0
  199. package/types/core/event/rules/keydown.rule.backspace.d.ts +18 -0
  200. package/types/core/event/rules/keydown.rule.delete.d.ts +18 -0
  201. package/types/core/event/rules/keydown.rule.enter.d.ts +18 -0
  202. package/types/core/event/rules/keydown.rule.tab.d.ts +18 -0
  203. package/types/core/event/support/defaultLineManager.d.ts +22 -0
  204. package/types/core/event/support/selectionState.d.ts +29 -0
  205. package/types/core/kernel/coreKernel.d.ts +219 -0
  206. package/types/core/kernel/kernelInjector.d.ts +16 -0
  207. package/types/core/kernel/store.d.ts +170 -0
  208. package/types/core/logic/dom/char.d.ts +46 -0
  209. package/types/core/logic/dom/format.d.ts +234 -0
  210. package/types/core/logic/dom/html.d.ts +290 -0
  211. package/types/core/logic/dom/inline.d.ts +93 -0
  212. package/types/core/logic/dom/listFormat.d.ts +101 -0
  213. package/types/core/logic/dom/nodeTransform.d.ts +110 -0
  214. package/types/core/logic/dom/offset.d.ts +335 -0
  215. package/types/core/logic/dom/selection.d.ts +165 -0
  216. package/types/core/logic/panel/menu.d.ts +93 -0
  217. package/types/core/logic/panel/toolbar.d.ts +128 -0
  218. package/types/core/logic/panel/viewer.d.ts +89 -0
  219. package/types/core/logic/shell/_commandExecutor.d.ts +18 -0
  220. package/types/core/logic/shell/commandDispatcher.d.ts +65 -0
  221. package/types/core/logic/shell/component.d.ts +182 -0
  222. package/types/core/logic/shell/focusManager.d.ts +31 -0
  223. package/types/core/{base → logic/shell}/history.d.ts +13 -12
  224. package/types/core/logic/shell/pluginManager.d.ts +115 -0
  225. package/types/core/logic/shell/shortcuts.d.ts +131 -0
  226. package/types/core/logic/shell/ui.d.ts +261 -0
  227. package/types/core/schema/context.d.ts +104 -0
  228. package/types/core/schema/frameContext.d.ts +320 -0
  229. package/types/core/schema/options.d.ts +1241 -0
  230. package/types/core/section/constructor.d.ts +117 -652
  231. package/types/core/section/documentType.d.ts +43 -61
  232. package/types/events.d.ts +796 -65
  233. package/types/helper/clipboard.d.ts +5 -4
  234. package/types/helper/converter.d.ts +55 -43
  235. package/types/helper/dom/domCheck.d.ts +27 -19
  236. package/types/helper/dom/domQuery.d.ts +76 -57
  237. package/types/helper/dom/domUtils.d.ts +62 -39
  238. package/types/helper/dom/index.d.ts +87 -1
  239. package/types/helper/env.d.ts +16 -13
  240. package/types/helper/index.d.ts +8 -2
  241. package/types/helper/keyCodeMap.d.ts +24 -23
  242. package/types/helper/numbers.d.ts +4 -6
  243. package/types/helper/unicode.d.ts +4 -3
  244. package/types/hooks/base.d.ts +239 -0
  245. package/types/hooks/params.d.ts +65 -0
  246. package/types/index.d.ts +20 -117
  247. package/types/interfaces/contracts.d.ts +183 -0
  248. package/types/interfaces/index.d.ts +3 -0
  249. package/types/interfaces/plugins.d.ts +168 -0
  250. package/types/langs/_Lang.d.ts +2 -2
  251. package/types/langs/index.d.ts +2 -2
  252. package/types/modules/contract/Browser.d.ts +262 -0
  253. package/types/modules/contract/ColorPicker.d.ts +99 -0
  254. package/types/modules/contract/Controller.d.ts +204 -0
  255. package/types/modules/contract/Figure.d.ts +529 -0
  256. package/types/modules/{HueSlider.d.ts → contract/HueSlider.d.ts} +39 -28
  257. package/types/modules/contract/Modal.d.ts +62 -0
  258. package/types/modules/contract/index.d.ts +7 -0
  259. package/types/modules/manager/ApiManager.d.ts +106 -0
  260. package/types/modules/manager/FileManager.d.ts +124 -0
  261. package/types/modules/manager/index.d.ts +3 -0
  262. package/types/modules/ui/ModalAnchorEditor.d.ts +152 -0
  263. package/types/modules/ui/SelectMenu.d.ts +107 -0
  264. package/types/modules/{_DragHandle.d.ts → ui/_DragHandle.d.ts} +1 -0
  265. package/types/modules/ui/index.d.ts +4 -0
  266. package/types/plugins/browser/audioGallery.d.ts +33 -41
  267. package/types/plugins/browser/fileBrowser.d.ts +42 -50
  268. package/types/plugins/browser/fileGallery.d.ts +33 -41
  269. package/types/plugins/browser/imageGallery.d.ts +30 -37
  270. package/types/plugins/browser/videoGallery.d.ts +33 -41
  271. package/types/plugins/command/blockquote.d.ts +4 -21
  272. package/types/plugins/command/exportPDF.d.ts +23 -33
  273. package/types/plugins/command/fileUpload.d.ts +80 -100
  274. package/types/plugins/command/list_bulleted.d.ts +9 -35
  275. package/types/plugins/command/list_numbered.d.ts +9 -35
  276. package/types/plugins/dropdown/align.d.ts +23 -46
  277. package/types/plugins/dropdown/backgroundColor.d.ts +35 -53
  278. package/types/plugins/dropdown/blockStyle.d.ts +45 -0
  279. package/types/plugins/dropdown/font.d.ts +18 -41
  280. package/types/plugins/dropdown/fontColor.d.ts +35 -53
  281. package/types/plugins/dropdown/hr.d.ts +26 -52
  282. package/types/plugins/dropdown/layout.d.ts +19 -25
  283. package/types/plugins/dropdown/lineHeight.d.ts +21 -39
  284. package/types/plugins/dropdown/list.d.ts +6 -34
  285. package/types/plugins/dropdown/paragraphStyle.d.ts +34 -45
  286. package/types/plugins/dropdown/table/index.d.ts +158 -0
  287. package/types/plugins/dropdown/table/render/table.html.d.ts +71 -0
  288. package/types/plugins/dropdown/table/render/table.menu.d.ts +59 -0
  289. package/types/plugins/dropdown/table/services/table.cell.d.ts +76 -0
  290. package/types/plugins/dropdown/table/services/table.clipboard.d.ts +26 -0
  291. package/types/plugins/dropdown/table/services/table.grid.d.ts +77 -0
  292. package/types/plugins/dropdown/table/services/table.resize.d.ts +72 -0
  293. package/types/plugins/dropdown/table/services/table.selection.d.ts +59 -0
  294. package/types/plugins/dropdown/table/services/table.style.d.ts +162 -0
  295. package/types/plugins/dropdown/table/shared/table.constants.d.ts +134 -0
  296. package/types/plugins/dropdown/table/shared/table.utils.d.ts +91 -0
  297. package/types/plugins/dropdown/template.d.ts +19 -25
  298. package/types/plugins/dropdown/textStyle.d.ts +23 -30
  299. package/types/plugins/field/mention.d.ts +66 -72
  300. package/types/plugins/index.d.ts +41 -40
  301. package/types/plugins/input/fontSize.d.ts +57 -96
  302. package/types/plugins/input/pageNavigator.d.ts +5 -8
  303. package/types/plugins/modal/audio.d.ts +60 -153
  304. package/types/plugins/modal/drawing.d.ts +16 -118
  305. package/types/plugins/modal/embed.d.ts +46 -166
  306. package/types/plugins/modal/image/index.d.ts +281 -0
  307. package/types/plugins/modal/image/render/image.html.d.ts +45 -0
  308. package/types/plugins/modal/image/services/image.size.d.ts +55 -0
  309. package/types/plugins/modal/image/services/image.upload.d.ts +24 -0
  310. package/types/plugins/modal/image/shared/image.constants.d.ts +17 -0
  311. package/types/plugins/modal/link.d.ts +46 -66
  312. package/types/plugins/modal/math.d.ts +17 -86
  313. package/types/plugins/modal/{video.d.ts → video/index.d.ts} +89 -221
  314. package/types/plugins/modal/video/render/video.html.d.ts +37 -0
  315. package/types/plugins/modal/video/services/video.size.d.ts +74 -0
  316. package/types/plugins/modal/video/services/video.upload.d.ts +19 -0
  317. package/types/plugins/popup/anchor.d.ts +8 -38
  318. package/types/suneditor.d.ts +55 -24
  319. package/types/typedef.d.ts +344 -228
  320. package/CONTRIBUTING.md +0 -186
  321. package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
  322. package/src/core/base/eventHandlers/handler_ww_mouse.js +0 -194
  323. package/src/core/base/eventManager.js +0 -1523
  324. package/src/core/class/component.js +0 -856
  325. package/src/core/class/format.js +0 -3433
  326. package/src/core/class/menu.js +0 -346
  327. package/src/core/class/selection.js +0 -610
  328. package/src/core/class/shortcuts.js +0 -98
  329. package/src/core/class/toolbar.js +0 -431
  330. package/src/core/class/ui.js +0 -424
  331. package/src/core/class/viewer.js +0 -750
  332. package/src/core/section/actives.js +0 -266
  333. package/src/core/section/context.js +0 -102
  334. package/src/editorInjector/_classes.js +0 -36
  335. package/src/editorInjector/_core.js +0 -87
  336. package/src/editorInjector/index.js +0 -73
  337. package/src/modules/ApiManager.js +0 -191
  338. package/src/modules/Controller.js +0 -474
  339. package/src/modules/Modal.js +0 -346
  340. package/src/modules/index.js +0 -14
  341. package/src/plugins/dropdown/table.js +0 -4034
  342. package/src/plugins/modal/image.js +0 -1376
  343. package/src/plugins/modal/video.js +0 -1226
  344. package/types/core/base/eventHandlers/handler_toolbar.d.ts +0 -41
  345. package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +0 -40
  346. package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +0 -35
  347. package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +0 -45
  348. package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +0 -39
  349. package/types/core/base/eventManager.d.ts +0 -401
  350. package/types/core/class/char.d.ts +0 -61
  351. package/types/core/class/component.d.ts +0 -213
  352. package/types/core/class/format.d.ts +0 -623
  353. package/types/core/class/html.d.ts +0 -430
  354. package/types/core/class/menu.d.ts +0 -126
  355. package/types/core/class/nodeTransform.d.ts +0 -93
  356. package/types/core/class/offset.d.ts +0 -522
  357. package/types/core/class/selection.d.ts +0 -188
  358. package/types/core/class/shortcuts.d.ts +0 -142
  359. package/types/core/class/toolbar.d.ts +0 -189
  360. package/types/core/class/ui.d.ts +0 -164
  361. package/types/core/class/viewer.d.ts +0 -140
  362. package/types/core/section/actives.d.ts +0 -46
  363. package/types/core/section/context.d.ts +0 -45
  364. package/types/editorInjector/_classes.d.ts +0 -41
  365. package/types/editorInjector/_core.d.ts +0 -87
  366. package/types/editorInjector/index.d.ts +0 -69
  367. package/types/modules/ApiManager.d.ts +0 -125
  368. package/types/modules/Browser.d.ts +0 -326
  369. package/types/modules/ColorPicker.d.ts +0 -135
  370. package/types/modules/Controller.d.ts +0 -251
  371. package/types/modules/Figure.d.ts +0 -517
  372. package/types/modules/FileManager.d.ts +0 -202
  373. package/types/modules/Modal.d.ts +0 -111
  374. package/types/modules/ModalAnchorEditor.d.ts +0 -236
  375. package/types/modules/SelectMenu.d.ts +0 -194
  376. package/types/modules/index.d.ts +0 -26
  377. package/types/plugins/dropdown/formatBlock.d.ts +0 -55
  378. package/types/plugins/dropdown/table.d.ts +0 -627
  379. package/types/plugins/modal/image.d.ts +0 -451
  380. /package/{LICENSE → LICENSE.txt} +0 -0
package/src/events.js CHANGED
@@ -2,31 +2,22 @@
2
2
  // This is a collection of functions that can be used in the editor's event callback.
3
3
  // ---------
4
4
 
5
- /**
6
- * @typedef {import('./modules/Controller').default} ControllerInstance
7
- */
8
-
9
5
  // --- native events
10
6
  /**
11
7
  * @typedef {Object} BaseEvent
12
- * @property {__se__EditorCore} editor - The root editor instance
13
- * @property {__se__FrameContext} frameContext - frame context
8
+ * @property {SunEditor.Deps} $ - Kernel dependencies
9
+ * @property {SunEditor.FrameContext} frameContext - frame context
14
10
  * @property {Event} event - event object
15
11
  */
16
12
 
17
13
  /**
18
14
  * @typedef {Object} ClipboardEvent
19
- * @property {__se__EditorCore} editor - The root editor instance
20
- * @property {__se__FrameContext} frameContext - frame context
15
+ * @property {SunEditor.Deps} $ - Kernel dependencies
16
+ * @property {SunEditor.FrameContext} frameContext - frame context
21
17
  * @property {Event} event - event object
22
18
  * @property {string} data - drop data
23
19
  * @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
20
+ * @property {string} from - `"SE"`|`"MS"`|`""` - source
30
21
  */
31
22
 
32
23
  // --- media
@@ -100,535 +91,809 @@
100
91
  * @property {string} align - align value
101
92
  * @property {boolean} isUpdate - new create or update
102
93
  * @property {string} url - embed url
103
- * @property {?HTMLElement} children - When the input source is stacked in an iframe, etc., the actual embedded DOM
94
+ * @property {?HTMLElement} children - When the input source is stacked in an `iframe`, etc., the actual embedded DOM
104
95
  * @property {?ProcessInfo} process - embed process info
105
96
  */
106
97
 
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
- };
98
+ // ----------------- [handlers] ---------------------------------------------------------------------------------------
99
+
100
+ /**
101
+ * @callback
102
+ * @description Fired when the editor has completed full initialization.
103
+ * This event is deferred via `setTimeout` to ensure all DOM layout calculations are complete,
104
+ * toolbar is visible, `ResizeObserver` is registered, and history stack is initialized.
105
+ * Use this event to safely call editor methods immediately after creation.
106
+ * @param {Object} params
107
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
108
+ */
109
+ function onload(params) {}
110
+
111
+ /**
112
+ * @callback
113
+ * @description Fired when the editor content area is scrolled.
114
+ * Use this to sync UI elements with scroll position or implement custom scroll behaviors.
115
+ * @param {BaseEvent} params
116
+ */
117
+ function onScroll(params) {}
118
+
119
+ /**
120
+ * @callback
121
+ * @description Fired when the user presses a mouse button down in the editor.
122
+ * Triggered before internal `mousedown` processing.
123
+ * Return `false` to prevent the default editor behavior.
124
+ * @param {BaseEvent} params
125
+ */
126
+ function onMouseDown(params) {}
127
+
128
+ /**
129
+ * @callback
130
+ * @description Fired when the user clicks in the editor.
131
+ * Triggered before component selection and default `line` creation.
132
+ * Return `false` to prevent the default editor behavior.
133
+ * @param {BaseEvent} params
134
+ */
135
+ function onClick(params) {}
136
+
137
+ /**
138
+ * @callback
139
+ * @description Fired before text input is inserted into the editor.
140
+ * Triggered after character count validation.
141
+ * Return `false` to prevent the input from being processed.
142
+ * @param {BaseEvent & {data: string}} params
143
+ */
144
+ function onBeforeInput(params) {}
145
+
146
+ /**
147
+ * @callback
148
+ * @description Fired when text content is input into the editor (typing, composition, paste).
149
+ * Triggered after default `line` creation and selection initialization.
150
+ * Return `false` to prevent history push.
151
+ * @param {BaseEvent & {data: string}} params
152
+ */
153
+ function onInput(params) {}
154
+
155
+ /**
156
+ * @callback
157
+ * @description Fired when the mouse cursor leaves the editor area.
158
+ * Return `false` to prevent the default editor behavior.
159
+ * @param {BaseEvent} params
160
+ */
161
+ function onMouseLeave(params) {}
162
+
163
+ /**
164
+ * @callback
165
+ * @description Fired when the user releases a mouse button in the editor.
166
+ * Triggered after internal selection updates.
167
+ * Return `false` to prevent the default editor behavior.
168
+ * @param {BaseEvent} params
169
+ */
170
+ function onMouseUp(params) {}
171
+
172
+ /**
173
+ * @callback
174
+ * @description Fired when a key is pressed down in the editor.
175
+ * Triggered before shortcut command execution and `keydown` reducers.
176
+ * Return `false` to prevent the default editor behavior including shortcuts, actions, and text input.
177
+ * @param {BaseEvent} params
178
+ */
179
+ function onKeyDown(params) {}
180
+
181
+ /**
182
+ * @callback
183
+ * @description Fired when a key is released in the editor.
184
+ * Triggered after format tag cleanup and zero-width character removal.
185
+ * Return `false` to prevent history push for history-relevant keys.
186
+ * @param {BaseEvent} params
187
+ */
188
+ function onKeyUp(params) {}
189
+
190
+ /**
191
+ * @callback
192
+ * @description Fired when the editor gains focus (managed focus via `editor.focusManager.focus()`).
193
+ * Triggered after toolbar display updates and status flags are set.
194
+ * This is different from `onNativeFocus` which fires on native DOM `focus` events.
195
+ * @param {BaseEvent} params
196
+ */
197
+ function onFocus(params) {}
198
+
199
+ /**
200
+ * @callback
201
+ * @description Fired when the editor receives a native DOM `focus` event.
202
+ * Triggered before managed focus processing.
203
+ * This is the raw browser `focus` event, use `onFocus` for managed focus handling.
204
+ * @param {BaseEvent} params
205
+ */
206
+ function onNativeFocus(params) {}
207
+
208
+ /**
209
+ * @callback
210
+ * @description Fired when the editor loses focus (managed blur via `editor.blur()`).
211
+ * Triggered after balloon toolbar is hidden and status flags are updated.
212
+ * This is different from `onNativeBlur` which fires on native DOM `blur` events.
213
+ * @param {BaseEvent} params
214
+ */
215
+ function onBlur(params) {}
216
+
217
+ /**
218
+ * @callback
219
+ * @description Fired when the editor receives a native DOM `blur` event.
220
+ * Triggered before managed blur processing.
221
+ * This is the raw browser `blur` event, use `onBlur` for managed blur handling.
222
+ * @param {BaseEvent} params
223
+ */
224
+ function onNativeBlur(params) {}
225
+
226
+ /**
227
+ * @callback
228
+ * @description Fired when the user attempts to copy content from the editor.
229
+ * Triggered before copying to clipboard.
230
+ * Return `false` to prevent the copy operation.
231
+ * @param {Object} params
232
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
233
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
234
+ * @param {Event} params.event - event object
235
+ * @param {Event} params.clipboardData - `clipboardData`
236
+ */
237
+ function onCopy(params) {}
238
+
239
+ /**
240
+ * @callback
241
+ * @description Fired when the user attempts to cut content from the editor.
242
+ * Triggered before cutting to clipboard.
243
+ * Return `false` to prevent the cut operation and history push.
244
+ * @param {Object} params
245
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
246
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
247
+ * @param {Event} params.event - event object
248
+ * @param {Event} params.clipboardData - `clipboardData`
249
+ */
250
+ function onCut(params) {}
251
+
252
+ /**
253
+ * @callback
254
+ * @description Fired when the editor content has changed.
255
+ * Triggered after history stack updates, undo/redo operations, and user edits.
256
+ * Use this to sync external state or validate content.
257
+ * The `data` parameter contains the current HTML content.
258
+ * @param {Object} params
259
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
260
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
261
+ * @param {string} params.data - editor HTML content
262
+ */
263
+ function onChange(params) {}
264
+
265
+ /**
266
+ * @callback
267
+ * @description Fired when a toolbar becomes visible.
268
+ * Triggered for balloon mode and inline mode toolbars.
269
+ * The `mode` parameter indicates the toolbar type (`balloon` or `inline`).
270
+ * @param {Object} params
271
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
272
+ * @param {HTMLElement} params.toolbar - Toolbar element
273
+ * @param {string} params.mode - Toolbar mode
274
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
275
+ */
276
+ function onShowToolbar(params) {}
277
+
278
+ /**
279
+ * @callback
280
+ * @description Fired after a component controller (floating toolbar) is displayed.
281
+ * Triggered when components (images, videos, tables) are selected.
282
+ * The `caller` parameter indicates which plugin triggered the controller.
283
+ * @param {Object} params
284
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
285
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
286
+ * @param {string} params.caller - caller plugin name
287
+ * @param {SunEditor.Module.Controller.Info} params.info - info object
288
+ */
289
+ function onShowController(params) {}
290
+
291
+ /**
292
+ * @callback
293
+ * @description Fired before a component controller (floating toolbar) is displayed.
294
+ * Triggered when components (images, videos, tables) are about to be selected.
295
+ * Return `false` to prevent the controller from showing.
296
+ * @param {Object} params
297
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
298
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
299
+ * @param {string} params.caller - caller plugin name
300
+ * @param {SunEditor.Module.Controller.Info} params.info - info object
301
+ */
302
+ function onBeforeShowController(params) {}
303
+
304
+ /**
305
+ * @callback
306
+ * @description Fired when the editor switches between WYSIWYG view and code view.
307
+ * The `is` parameter indicates whether code view is now active (`true`) or WYSIWYG view is active (`false`).
308
+ * @param {Object} params
309
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
310
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
311
+ * @param {boolean} params.is - code view status
312
+ */
313
+ function onToggleCodeView(params) {}
314
+
315
+ /**
316
+ * @callback
317
+ * @description Fired when the editor enters or exits fullscreen mode.
318
+ * The `is` parameter indicates whether fullscreen mode is now active (`true`) or normal mode is active (`false`).
319
+ * @param {Object} params
320
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
321
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
322
+ * @param {boolean} params.is - full screen status
323
+ */
324
+ function onToggleFullScreen(params) {}
325
+
326
+ /**
327
+ * @callback
328
+ * @description Fired when the editor's wysiwyg area height changes.
329
+ * Triggered by `ResizeObserver`.
330
+ * Use this to sync external UI elements or implement custom resize behaviors.
331
+ * Parameters include current height, previous height, and the `ResizeObserverEntry`.
332
+ * @param {Object} params
333
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
334
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
335
+ * @param {number} params.height - wysiwyg area frame height
336
+ * @param {boolean} params.prevHeight - wysiwyg area previous height
337
+ * @param {ResizeObserverEntry} params.observerEntry - ResizeObserverEntry
338
+ */
339
+ function onResizeEditor(params) {}
340
+
341
+ /**
342
+ * @callback
343
+ * @description Fired after toolbar buttons are created and rendered.
344
+ * Triggered during toolbar initialization and `resetToolbarButtons()`.
345
+ * Use this to customize toolbar DOM or add custom elements to the `buttonTray`.
346
+ * @param {Object} params
347
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
348
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
349
+ * @param {HTMLElement} params.buttonTray - button tray element
350
+ */
351
+ function onSetToolbarButtons(params) {}
352
+
353
+ /**
354
+ * @callback
355
+ * @description Fired when the save command is executed (Ctrl+S or save button).
356
+ * Use this to send editor content to a server or perform custom save logic.
357
+ * Return a Promise resolving to `false` to prevent the save operation from completing.
358
+ * @param {Object} params
359
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
360
+ * @param {SunEditor.FrameContext} params.frameContext - frame context
361
+ * @param {Event} params.data - editor data
362
+ * @returns {PromiseLike<boolean>}
363
+ */
364
+ function onSave(params) {
365
+ return;
366
+ }
367
+
368
+ /**
369
+ * @callback
370
+ * @description Fired when toolbar button states are reset.
371
+ * Triggered during undo/redo operations and history navigation.
372
+ * Use this to update custom toolbar buttons or external UI state.
373
+ * @param {Object} params
374
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
375
+ * @param {string} params.rootKey - frame key
376
+ */
377
+ function onResetButtons(params) {}
378
+
379
+ /**
380
+ * @callback
381
+ * @description Fired before a font family change is applied to the selection.
382
+ * Triggered by font dropdown selection.
383
+ * Return a Promise resolving to `false` to cancel the font change operation.
384
+ * @param {Object} params
385
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
386
+ * @param {string} params.value - font value
387
+ * @returns {PromiseLike<boolean | void>}
388
+ */
389
+ function onFontActionBefore(params) {
390
+ return;
391
+ }
392
+
393
+ /**
394
+ * @callback
395
+ * @description Fired when the user attempts to drop content into the editor.
396
+ * Triggered after HTML cleaning and character count validation.
397
+ * Return `false` to cancel drop, or return a string to replace the drop data.
398
+ * @param {ClipboardEvent} params
399
+ * @returns {PromiseLike<boolean | string>}
400
+ */
401
+ function onDrop(params) {
402
+ return;
403
+ }
404
+
405
+ /**
406
+ * @callback
407
+ * @description Fired when the user attempts to paste content into the editor.
408
+ * Triggered after HTML cleaning and character count validation.
409
+ * Return `false` to cancel paste, or return a string to replace the paste data.
410
+ * @param {ClipboardEvent} params
411
+ * @returns {PromiseLike<boolean | string | void>}
412
+ */
413
+ function onPaste(params) {
414
+ return;
415
+ }
416
+
417
+ /**
418
+ * @callback
419
+ * @description Custom handler for image upload requests.
420
+ * Fired after the `XMLHttpRequest` is sent but before default response processing.
421
+ * Return a Promise resolving to `true` if you handle the upload response yourself,
422
+ * or `false` to use default processing. The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
423
+ * @param {Object} params
424
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
425
+ * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
426
+ * @param {ImageInfo} params.info - info object
427
+ * @returns {PromiseLike<boolean | void>}
428
+ */
429
+ function imageUploadHandler(params) {
430
+ return;
431
+ }
432
+
433
+ /**
434
+ * @callback
435
+ * @description Fired before an image is uploaded to the server.
436
+ * Use this to validate, resize, or modify image data before upload.
437
+ * Return `false` to cancel upload, return an `ImageInfo` object to modify the upload data,
438
+ * or call the `handler` parameter to proceed with modified data.
439
+ * @param {Object} params
440
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
441
+ * @param {ImageInfo} params.info - info object
442
+ * @param {(newInfo?: ImageInfo | null) => void} params.handler - handler function
443
+ * @returns {PromiseLike<boolean | ImageInfo | void>}
444
+ */
445
+ function onImageUploadBefore(params) {
446
+ return;
447
+ }
448
+
449
+ /**
450
+ * @callback
451
+ * @description Fired after images are successfully loaded into the editor.
452
+ * Triggered after upload completion or URL-based image insertion.
453
+ * The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded images.
454
+ * @param {Object} params
455
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
456
+ * @param {Array<FileManagementInfo>} params.infoList - info list
457
+ */
458
+ function onImageLoad(params) {}
459
+
460
+ /**
461
+ * @callback
462
+ * @description Fired when an image is created, updated, or deleted in the editor.
463
+ * The `state` parameter indicates the action type (`create`, `update`, or `delete`).
464
+ * Use this to sync image state with external systems or track image modifications.
465
+ * @param {Object} params
466
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
467
+ * @param {FileManagementInfo} params.info - info object
468
+ * @param {HTMLElement | null} params.element - target element
469
+ * @param {"create" | "update" | "delete"} params.state - state
470
+ * @param {number} params.index - data index
471
+ * @param {number} params.remainingFilesCount - remaining files count
472
+ * @param {string} params.pluginName - plugin name
473
+ */
474
+ function onImageAction(params) {}
475
+
476
+ /**
477
+ * @callback
478
+ * @description Fired when an image upload fails due to size limits, server errors, or other issues.
479
+ * Return a Promise resolving to a custom error message string to override the default error message,
480
+ * or `undefined` to use the default message.
481
+ * @param {Object} params
482
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
483
+ * @param {string} params.error - error message
484
+ * @param {number} [params.limitSize] - limit size
485
+ * @param {number} [params.uploadSize] - upload size
486
+ * @param {number} [params.currentSize] - current size
487
+ * @param {File} [params.file] - File object
488
+ * @returns {PromiseLike<string | void>}
489
+ */
490
+ function onImageUploadError(params) {
491
+ return;
492
+ }
493
+
494
+ /**
495
+ * @callback
496
+ * @description Fired before an image is deleted from the editor.
497
+ * Use this to confirm deletion, notify server, or perform cleanup.
498
+ * Return a Promise resolving to `false` to prevent the image from being deleted.
499
+ * @param {Object} params
500
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
501
+ * @param {HTMLElement} params.element - target element
502
+ * @param {HTMLElement} params.container - target's container element (div)
503
+ * @param {string} params.align - align value
504
+ * @param {string} params.alt - alt text value
505
+ * @param {?string} params.url - Anchor url, if it exists
506
+ * @returns {PromiseLike<boolean>}
507
+ */
508
+ function onImageDeleteBefore(params) {
509
+ return;
510
+ }
511
+
512
+ /**
513
+ * @callback
514
+ * @description Custom handler for video upload requests.
515
+ * Fired after the `XMLHttpRequest` is sent but before default response processing.
516
+ * Return a Promise resolving to `true` if you handle the upload response yourself,
517
+ * or `false` to use default processing.
518
+ * The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
519
+ * @param {Object} params
520
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
521
+ * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
522
+ * @param {VideoInfo} params.info - info object
523
+ * @returns {PromiseLike<boolean>}
524
+ */
525
+ function videoUploadHandler(params) {
526
+ return;
527
+ }
528
+
529
+ /**
530
+ * @callback
531
+ * @description Fired before a video is uploaded to the server.
532
+ * Use this to validate, transcode, or modify video data before upload.
533
+ * Return `false` to cancel upload, return a `VideoInfo` object to modify the upload data,
534
+ * or call the `handler` parameter to proceed with modified data.
535
+ * @param {Object} params
536
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
537
+ * @param {VideoInfo} params.info - info object
538
+ * @param {(newInfo?: VideoInfo | null) => void} params.handler - handler function
539
+ * @returns {PromiseLike<boolean | VideoInfo | void>}
540
+ */
541
+ function onVideoUploadBefore(params) {
542
+ return;
543
+ }
544
+
545
+ /**
546
+ * @callback
547
+ * @description Fired after videos are successfully loaded into the editor.
548
+ * Triggered after upload completion or URL-based video insertion (iframe/video tag).
549
+ * The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded videos.
550
+ * @param {Object} params
551
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
552
+ * @param {Array<FileManagementInfo>} params.infoList - info list
553
+ */
554
+ function onVideoLoad(params) {}
555
+
556
+ /**
557
+ * @callback
558
+ * @description Fired when a video is created, updated, or deleted in the editor.
559
+ * The `state` parameter indicates the action type (`create`, `update`, or `delete`).
560
+ * Use this to sync video state with external systems or track video modifications.
561
+ * @param {Object} params
562
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
563
+ * @param {FileManagementInfo} params.info - info object
564
+ * @param {HTMLElement | null} params.element - target element
565
+ * @param {"create" | "update" | "delete"} params.state - state
566
+ * @param {number} params.index - data index
567
+ * @param {number} params.remainingFilesCount - remaining files count
568
+ * @param {string} params.pluginName - plugin name
569
+ */
570
+ function onVideoAction(params) {}
571
+
572
+ /**
573
+ * @callback
574
+ * @description Fired when a video upload fails due to size limits, server errors, or other issues.
575
+ * Return a Promise resolving to a custom error message string to override the default error message,
576
+ * or `undefined` to use the default message.
577
+ * @param {Object} params
578
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
579
+ * @param {string} params.error - error message
580
+ * @param {number} [params.limitSize] - limit size
581
+ * @param {number} [params.uploadSize] - upload size
582
+ * @param {number} [params.currentSize] - current size
583
+ * @param {File} [params.file] - File object
584
+ * @returns {PromiseLike<string | void>}
585
+ */
586
+ function onVideoUploadError(params) {
587
+ return;
588
+ }
589
+
590
+ /**
591
+ * @callback
592
+ * @description Fired before a video is deleted from the editor.
593
+ * Use this to confirm deletion, notify server, or perform cleanup.
594
+ * Return a Promise resolving to `false` to prevent the video from being deleted.
595
+ * @param {Object} params
596
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
597
+ * @param {HTMLElement} params.element - target element
598
+ * @param {HTMLElement} params.container - target's container element (div)
599
+ * @param {string} params.align - align value
600
+ * @param {string} params.url - video url
601
+ * @returns {PromiseLike<boolean>}
602
+ */
603
+ function onVideoDeleteBefore(params) {
604
+ return;
605
+ }
606
+
607
+ /**
608
+ * @callback
609
+ * @description Custom handler for audio upload requests.
610
+ * Fired after the `XMLHttpRequest` is sent but before default response processing.
611
+ * Return a Promise resolving to `true` if you handle the upload response yourself,
612
+ * or `false` to use default processing.
613
+ * The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
614
+ * @param {Object} params
615
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
616
+ * @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
617
+ * @param {AudioInfo} params.info - info object
618
+ * @returns {PromiseLike<boolean>}
619
+ */
620
+ function audioUploadHandler(params) {
621
+ return;
622
+ }
623
+
624
+ /**
625
+ * @callback
626
+ * @description Fired before an audio file is uploaded to the server.
627
+ * Use this to validate, transcode, or modify audio data before upload.
628
+ * Return `false` to cancel upload, return an `AudioInfo` object to modify the upload data,
629
+ * or call the `handler` parameter to proceed with modified data.
630
+ * @param {Object} params
631
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
632
+ * @param {AudioInfo} params.info - info object
633
+ * @param {(newInfo?: AudioInfo | null) => void} params.handler - handler function
634
+ * @returns {PromiseLike<boolean | AudioInfo| void>}
635
+ */
636
+ function onAudioUploadBefore(params) {
637
+ return;
638
+ }
639
+
640
+ /**
641
+ * @callback
642
+ * @description Fired when an audio upload fails due to size limits, server errors, or other issues.
643
+ * Return a Promise resolving to a custom error message string to override the default error message,
644
+ * or `undefined` to use the default message.
645
+ * @param {Object} params
646
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
647
+ * @param {string} params.error - error message
648
+ * @param {number} [params.limitSize] - limit size
649
+ * @param {number} [params.uploadSize] - upload size
650
+ * @param {number} [params.currentSize] - current size
651
+ * @param {File} [params.file] - File object
652
+ * @returns {PromiseLike<string | void>}
653
+ */
654
+ function onAudioUploadError(params) {
655
+ return;
656
+ }
657
+
658
+ /**
659
+ * @callback
660
+ * @description Fired after audio files are successfully loaded into the editor.
661
+ * Triggered after upload completion or URL-based audio insertion.
662
+ * The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded audio files.
663
+ * @param {Object} params
664
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
665
+ * @param {Array<FileManagementInfo>} params.infoList - info list
666
+ */
667
+ function onAudioLoad(params) {}
668
+
669
+ /**
670
+ * @callback
671
+ * @description Fired when an audio element is created, updated, or deleted in the editor.
672
+ * The `state` parameter indicates the action type (`create`, `update`, or `delete`).
673
+ * Use this to sync audio state with external systems or track audio modifications.
674
+ * @param {Object} params
675
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
676
+ * @param {FileManagementInfo} params.info - info object
677
+ * @param {HTMLElement | null} params.element - target element
678
+ * @param {"create" | "update" | "delete"} params.state - state
679
+ * @param {number} params.index - data index
680
+ * @param {number} params.remainingFilesCount - remaining files count
681
+ * @param {string} params.pluginName - plugin name
682
+ */
683
+ function onAudioAction(params) {}
684
+
685
+ /**
686
+ * @callback
687
+ * @description Fired before an audio element is deleted from the editor.
688
+ * Use this to confirm deletion, notify server, or perform cleanup.
689
+ * Return a Promise resolving to `false` to prevent the audio from being deleted.
690
+ * @param {Object} params
691
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
692
+ * @param {HTMLElement} params.element - target element
693
+ * @param {HTMLElement} params.container - target's container element (div)
694
+ * @param {string} params.url - audio url
695
+ * @returns {PromiseLike<boolean>}
696
+ */
697
+ function onAudioDeleteBefore(params) {
698
+ return;
699
+ }
700
+
701
+ /**
702
+ * @callback
703
+ * @description Fired before a file is uploaded to the server (via `fileUpload` plugin).
704
+ * Use this to validate or modify file data before upload.
705
+ * Return `false` to cancel upload, return a `FileInfo` object to modify the upload data,
706
+ * or call the `handler` parameter to proceed with modified data.
707
+ * @param {Object} params
708
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
709
+ * @param {FileInfo} params.info - info object
710
+ * @param {(newInfo?: FileInfo | null) => void} params.handler - handler function
711
+ * @returns {PromiseLike<boolean | FileInfo | void>}
712
+ */
713
+ function onFileUploadBefore(params) {
714
+ return;
715
+ }
716
+
717
+ /**
718
+ * @callback
719
+ * @description Fired after files are successfully uploaded and loaded into the editor.
720
+ * Triggered by the `fileUpload` plugin after upload completion.
721
+ * The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded files.
722
+ * @param {Object} params
723
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
724
+ * @param {Array<FileManagementInfo>} params.infoList - info list
725
+ */
726
+ function onFileLoad(params) {}
727
+
728
+ /**
729
+ * @callback
730
+ * @description Fired when a file link is created, updated, or deleted in the editor.
731
+ * The `state` parameter indicates the action type (`create`, `update`, or `delete`).
732
+ * Use this to sync file state with external systems or track file modifications.
733
+ * @param {Object} params
734
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
735
+ * @param {FileManagementInfo} params.info - info object
736
+ * @param {HTMLElement | null} params.element - target element
737
+ * @param {"create" | "update" | "delete"} params.state - state
738
+ * @param {number} params.index - data index
739
+ * @param {number} params.remainingFilesCount - remaining files count
740
+ * @param {string} params.pluginName - plugin name
741
+ */
742
+ function onFileAction(params) {}
743
+
744
+ /**
745
+ * @callback
746
+ * @description Fired when a file upload fails due to size limits, server errors, or other issues.
747
+ * Return a Promise resolving to a custom error message string to override the default error message,
748
+ * or `undefined` to use the default message.
749
+ * @param {Object} params
750
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
751
+ * @param {string} params.error - error message
752
+ * @param {number} [params.limitSize] - limit size
753
+ * @param {number} [params.uploadSize] - upload size
754
+ * @param {number} [params.currentSize] - current size
755
+ * @param {File} [params.file] - File object
756
+ * @returns {PromiseLike<string | void>}
757
+ */
758
+ function onFileUploadError(params) {
759
+ return;
760
+ }
761
+
762
+ /**
763
+ * @callback
764
+ * @description Fired before a file link is deleted from the editor.
765
+ * Use this to confirm deletion, notify server, or perform cleanup.
766
+ * Return a Promise resolving to `false` to prevent the file link from being deleted.
767
+ * @param {Object} params
768
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
769
+ * @param {HTMLElement} params.element - target element
770
+ * @param {HTMLElement} params.container - target's container element (div)
771
+ * @param {string} params.url - file url
772
+ * @returns {PromiseLike<boolean>}
773
+ */
774
+ function onFileDeleteBefore(params) {
775
+ return;
776
+ }
777
+
778
+ /**
779
+ * @callback
780
+ * @description Fired before the editor content is exported to PDF.
781
+ * Use this to modify content, add metadata, or cancel the export.
782
+ * Return a Promise resolving to `false` to prevent the PDF export.
783
+ * @param {Object} params
784
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
785
+ * @param {HTMLElement} params.target - wysiwyg editable element
786
+ * @returns {PromiseLike<boolean>}
787
+ */
788
+ function onExportPDFBefore(params) {
789
+ return;
790
+ }
791
+
792
+ /**
793
+ * @callback
794
+ * @description Fired when any media element (image, video, audio, file) is created, updated, or deleted.
795
+ * This is a unified event that triggers for all media types.
796
+ * The `pluginName` parameter indicates which plugin triggered the action (`image`, `video`, `audio`, or `file`).
797
+ * @param {Object} params
798
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
799
+ * @param {FileManagementInfo} params.info - info object
800
+ * @param {HTMLElement | null} params.element - target element
801
+ * @param {"create" | "update" | "delete"} params.state - state
802
+ * @param {number} params.index - data index
803
+ * @param {number} params.remainingFilesCount - remaining files count
804
+ * @param {string} params.pluginName - plugin name
805
+ */
806
+ function onFileManagerAction(params) {}
807
+
808
+ /**
809
+ * @callback
810
+ * @description Fired before an embed URL is processed and inserted into the editor.
811
+ * Use this to validate URLs, add custom embed processors, or modify embed parameters.
812
+ * Return `false` to cancel insertion, return an `EmbedInfo` object to modify the embed data,
813
+ * or call the `handler` parameter to proceed with modified data.
814
+ * @param {EmbedInfo & {$: SunEditor.Deps, handler: (newInfo?: EmbedInfo | null) => void}} params
815
+ * @returns {PromiseLike<boolean | EmbedInfo | void>}
816
+ */
817
+ function onEmbedInputBefore(params) {
818
+ return;
819
+ }
820
+
821
+ /**
822
+ * @callback
823
+ * @description Fired before an embedded element (iframe, custom embed) is deleted from the editor.
824
+ * Use this to confirm deletion or perform cleanup.
825
+ * Return a Promise resolving to `false` to prevent the embed from being deleted.
826
+ * @param {Object} params
827
+ * @param {SunEditor.Deps} params.$ - Kernel dependencies
828
+ * @param {HTMLElement} params.element - target element
829
+ * @param {HTMLElement} params.container - target's container element (div)
830
+ * @param {string} params.align - align value
831
+ * @param {string} params.url - embed url
832
+ * @returns {PromiseLike<boolean>}
833
+ */
834
+ function onEmbedDeleteBefore(params) {
835
+ return;
836
+ }
837
+
838
+ // ------------------------------------------------ Exports ------------------------------------------------
839
+ /**
840
+ * @typedef {Object} EventHandlers
841
+ * @property {?onload} [onload]
842
+ * @property {?onScroll} [onScroll]
843
+ * @property {?onMouseDown} [onMouseDown]
844
+ * @property {?onClick} [onClick]
845
+ * @property {?onBeforeInput} [onBeforeInput]
846
+ * @property {?onInput} [onInput]
847
+ * @property {?onMouseLeave} [onMouseLeave]
848
+ * @property {?onMouseUp} [onMouseUp]
849
+ * @property {?onKeyDown} [onKeyDown]
850
+ * @property {?onKeyUp} [onKeyUp]
851
+ * @property {?onFocus} [onFocus]
852
+ * @property {?onNativeFocus} [onNativeFocus]
853
+ * @property {?onBlur} [onBlur]
854
+ * @property {?onNativeBlur} [onNativeBlur]
855
+ * @property {?onCopy} [onCopy]
856
+ * @property {?onCut} [onCut]
857
+ * @property {?onChange} [onChange]
858
+ * @property {?onShowToolbar} [onShowToolbar]
859
+ * @property {?onShowController} [onShowController]
860
+ * @property {?onBeforeShowController} [onBeforeShowController]
861
+ * @property {?onToggleCodeView} [onToggleCodeView]
862
+ * @property {?onToggleFullScreen} [onToggleFullScreen]
863
+ * @property {?onResizeEditor} [onResizeEditor]
864
+ * @property {?onSetToolbarButtons} [onSetToolbarButtons]
865
+ * @property {?onSave} [onSave]
866
+ * @property {?onResetButtons} [onResetButtons]
867
+ * @property {?onFontActionBefore} [onFontActionBefore]
868
+ * @property {?onDrop} [onDrop]
869
+ * @property {?onPaste} [onPaste]
870
+ * @property {?imageUploadHandler} [imageUploadHandler]
871
+ * @property {?onImageUploadBefore} [onImageUploadBefore]
872
+ * @property {?onImageLoad} [onImageLoad]
873
+ * @property {?onImageAction} [onImageAction]
874
+ * @property {?onImageUploadError} [onImageUploadError]
875
+ * @property {?onImageDeleteBefore} [onImageDeleteBefore]
876
+ * @property {?videoUploadHandler} [videoUploadHandler]
877
+ * @property {?onVideoUploadBefore} [onVideoUploadBefore]
878
+ * @property {?onVideoLoad} [onVideoLoad]
879
+ * @property {?onVideoAction} [onVideoAction]
880
+ * @property {?onVideoUploadError} [onVideoUploadError]
881
+ * @property {?onVideoDeleteBefore} [onVideoDeleteBefore]
882
+ * @property {?audioUploadHandler} [audioUploadHandler]
883
+ * @property {?onAudioUploadBefore} [onAudioUploadBefore]
884
+ * @property {?onAudioUploadError} [onAudioUploadError]
885
+ * @property {?onAudioLoad} [onAudioLoad]
886
+ * @property {?onAudioAction} [onAudioAction]
887
+ * @property {?onAudioDeleteBefore} [onAudioDeleteBefore]
888
+ * @property {?onFileUploadBefore} [onFileUploadBefore]
889
+ * @property {?onFileLoad} [onFileLoad]
890
+ * @property {?onFileAction} [onFileAction]
891
+ * @property {?onFileUploadError} [onFileUploadError]
892
+ * @property {?onFileDeleteBefore} [onFileDeleteBefore]
893
+ * @property {?onExportPDFBefore} [onExportPDFBefore]
894
+ * @property {?onFileManagerAction} [onFileManagerAction]
895
+ * @property {?onEmbedInputBefore} [onEmbedInputBefore]
896
+ * @property {?onEmbedDeleteBefore} [onEmbedDeleteBefore]
897
+ */
898
+
899
+ export {};