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
@@ -1,3 +1,4 @@
1
+ import type {} from '../../typedef';
1
2
  export default Math_;
2
3
  export type MathPluginOptions = {
3
4
  /**
@@ -15,7 +16,7 @@ export type MathPluginOptions = {
15
16
  /**
16
17
  * - A callback function to handle paste events in the math input area.
17
18
  */
18
- onPaste?: (...args: any) => any;
19
+ onPaste?: ((...args: any) => any) | null;
19
20
  /**
20
21
  * - An object specifying the dimensions for the math modal.
21
22
  */
@@ -33,7 +34,7 @@ export type MathPluginOptions = {
33
34
  * @property {boolean} [canResize=true] - Whether the math modal can be resized.
34
35
  * @property {boolean} [autoHeight=false] - Whether to automatically adjust the height of the modal.
35
36
  * @property {Array<object>} [fontSizeList] - A list of font size options for rendering math expressions.
36
- * @property {(...args: *) => *} [onPaste] - A callback function to handle paste events in the math input area.
37
+ * @property {?(...args: *) => *} [onPaste] - A callback function to handle paste events in the math input area.
37
38
  * @property {Object} [formSize={}] - An object specifying the dimensions for the math modal.
38
39
  * @property {string} [formSize.width="460px"] - The default width of the math modal.
39
40
  * @property {string} [formSize.height="14em"] - The default height of the math modal.
@@ -45,27 +46,22 @@ export type MathPluginOptions = {
45
46
  /**
46
47
  * @class
47
48
  * @description Math plugin.
48
- * - This plugin provides support for rendering mathematical expressions using either the KaTeX or MathJax libraries.
49
+ * - This plugin provides support for rendering mathematical expressions using either the `KaTeX` or `MathJax` libraries.
49
50
  * - If external library is provided, a warning is issued.
50
51
  */
51
- declare class Math_ extends EditorInjector {
52
- static key: string;
53
- static type: string;
54
- static className: string;
52
+ declare class Math_ extends PluginModal {
55
53
  /**
56
- * @this {Math_}
57
54
  * @param {HTMLElement} node - The node to check.
58
55
  * @returns {HTMLElement|null} Returns a node if the node is a valid component.
59
56
  */
60
- static component(this: Math_, node: HTMLElement): HTMLElement | null;
57
+ static component(node: HTMLElement): HTMLElement | null;
61
58
  /**
62
59
  * @constructor
63
- * @param {__se__EditorCore} editor - The root editor instance
60
+ * @param {SunEditor.Kernel} editor - The core kernel
64
61
  * @param {MathPluginOptions} pluginOptions
65
62
  */
66
- constructor(editor: __se__EditorCore, pluginOptions: MathPluginOptions);
63
+ constructor(editor: SunEditor.Kernel, pluginOptions: MathPluginOptions);
67
64
  title: any;
68
- icon: string;
69
65
  katex: any;
70
66
  mathjax: any;
71
67
  pluginOptions: {
@@ -110,84 +106,19 @@ declare class Math_ extends EditorInjector {
110
106
  /** @type {HTMLSelectElement} */
111
107
  fontSizeElement: HTMLSelectElement;
112
108
  isUpdateState: boolean;
113
- _element: HTMLElement;
114
- /**
115
- * @editorMethod Editor.component
116
- * @description Executes the method that is called when a component of a plugin is selected.
117
- * @param {HTMLElement} target Target component element
118
- */
119
- select(target: HTMLElement): void;
120
- /**
121
- * @editorMethod Modules.Controller
122
- * @description This function is called before the "controller" before it is closed.
123
- */
124
- close(): void;
125
- /**
126
- * @editorMethod Editor.core
127
- * @description This method is used to validate and preserve the format of the component within the editor.
128
- * - It ensures that the structure and attributes of the element are maintained and secure.
129
- * - The method checks if the element is already wrapped in a valid container and updates its attributes if necessary.
130
- * - If the element isn't properly contained, a new container is created to retain the format.
131
- * @returns {{query: string, method: (element: HTMLElement) => void}} The format retention object containing the query and method to process the element.
132
- * - query: The selector query to identify the relevant elements (in this case, 'audio').
133
- * - method:The function to execute on the element to validate and preserve its format.
134
- * - The function takes the element as an argument, checks if it is contained correctly, and applies necessary adjustments.
135
- */
136
109
  retainFormat(): {
137
110
  query: string;
138
111
  method: (element: HTMLElement) => void;
139
112
  };
140
- /**
141
- * @editorMethod Modules.Modal
142
- * @description Executes the method that is called when a "Modal" module's is opened.
143
- */
144
- open(): void;
145
- /**
146
- * @editorMethod Modules.Modal
147
- * @description Executes the method that is called when a plugin's modal is opened.
148
- * @param {boolean} isUpdate "Indicates whether the modal is for editing an existing component (true) or registering a new one (false)."
149
- */
150
- on(isUpdate: boolean): void;
151
- /**
152
- * @editorMethod Modules.Modal
153
- * @description This function is called when a form within a modal window is "submit".
154
- * @returns {boolean} Success or failure
155
- */
156
- modalAction(): boolean;
157
- /**
158
- * @editorMethod Modules.Modal
159
- * @description This function is called before the modal window is opened, but before it is closed.
160
- */
161
- init(): void;
162
- /**
163
- * @editorMethod Modules.Controller
164
- * @description Executes the method that is called when a button is clicked in the "controller".
165
- * @param {HTMLButtonElement} target Target button element
166
- */
113
+ modalOn(isUpdate: boolean): void;
114
+ modalAction(): Promise<boolean>;
115
+ modalInit(): void;
167
116
  controllerAction(target: HTMLButtonElement): void;
168
- /**
169
- * @editorMethod Editor.Component
170
- * @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
171
- * @param {Node} target Target element
172
- */
173
- destroy(target: Node): void;
174
- /**
175
- * @private
176
- * @description Renders the given math expression using KaTeX or MathJax.
177
- * @param {string} exp - The math expression to render.
178
- * @returns {string} - The rendered math expression as HTML.
179
- */
180
- private _renderer;
181
- /**
182
- * @private
183
- * @description Escapes or unescapes backslashes in a given string.
184
- * @param {string} str - The input string.
185
- * @param {boolean} decode - If true, decodes escaped backslashes; otherwise, encodes them.
186
- * @returns {string} - The processed string.
187
- */
188
- private _escapeBackslashes;
117
+ controllerClose(): void;
118
+ componentSelect(target: HTMLElement): void | boolean;
119
+ componentDestroy(target: HTMLElement): Promise<void>;
189
120
  #private;
190
121
  }
191
- import EditorInjector from '../../editorInjector';
192
- import { Modal } from '../../modules';
193
- import { Controller } from '../../modules';
122
+ import { PluginModal } from '../../interfaces';
123
+ import { Modal } from '../../modules/contract';
124
+ import { Controller } from '../../modules/contract';
@@ -1,21 +1,5 @@
1
+ import type {} from '../../../typedef';
1
2
  export default Video;
2
- export type ModalReturns_video = {
3
- html: HTMLElement;
4
- alignForm: HTMLElement;
5
- fileModalWrapper: HTMLElement;
6
- videoInputFile: HTMLInputElement;
7
- videoUrlFile: HTMLInputElement;
8
- previewSrc: HTMLElement;
9
- galleryButton: HTMLButtonElement;
10
- proportion: HTMLInputElement;
11
- frameRatioOption: HTMLSelectElement;
12
- inputX: HTMLInputElement;
13
- inputY: HTMLInputElement;
14
- revertBtn: HTMLButtonElement;
15
- fileRemoveBtn: HTMLButtonElement;
16
- };
17
- export type VideoInfo_video = import('../../events').VideoInfo;
18
- export type FigureControls_video = import('../../modules/Figure').FigureControls;
19
3
  export type VideoPluginOptions = {
20
4
  /**
21
5
  * - Whether the video element can be resized.
@@ -26,11 +10,11 @@ export type VideoPluginOptions = {
26
10
  */
27
11
  showHeightInput?: boolean;
28
12
  /**
29
- * - The default width of the video element. If a number is provided, "px" will be appended.
13
+ * - The default width of the video element. If a number is provided, `"px"` will be appended.
30
14
  */
31
15
  defaultWidth?: string;
32
16
  /**
33
- * - The default height of the video element. If a number is provided, "px" will be appended.
17
+ * - The default height of the video element. If a number is provided, `"px"` will be appended.
34
18
  */
35
19
  defaultHeight?: string;
36
20
  /**
@@ -68,7 +52,7 @@ export type VideoPluginOptions = {
68
52
  */
69
53
  allowMultiple?: boolean;
70
54
  /**
71
- * - Accepted file formats for video uploads.
55
+ * - Accepted file formats for video uploads (`"video/*"`).
72
56
  */
73
57
  acceptedFormats?: string;
74
58
  /**
@@ -84,13 +68,13 @@ export type VideoPluginOptions = {
84
68
  */
85
69
  ratioOptions?: any[];
86
70
  /**
87
- * - Additional attributes to set on the video tag.
71
+ * - Additional attributes to set on the `VIDEO` tag.
88
72
  */
89
73
  videoTagAttributes?: {
90
74
  [x: string]: string;
91
75
  };
92
76
  /**
93
- * - Additional attributes to set on the iframe tag.
77
+ * - Additional attributes to set on the `IFRAME` tag.
94
78
  */
95
79
  iframeTagAttributes?: {
96
80
  [x: string]: string;
@@ -124,20 +108,27 @@ export type VideoPluginOptions = {
124
108
  /**
125
109
  * - Figure controls.
126
110
  */
127
- controls?: FigureControls_video;
111
+ controls?: SunEditor.Module.Figure.Controls;
112
+ /**
113
+ * - Component insertion behavior for selection and cursor placement. [default: `options.get('componentInsertBehavior')`]
114
+ * - `auto`: Move cursor to the next line if possible, otherwise select the component.
115
+ * - `select`: Always select the inserted component.
116
+ * - `line`: Move cursor to the next line if possible, or create a new line and move there.
117
+ * - `none`: Do nothing.
118
+ */
119
+ insertBehavior?: SunEditor.ComponentInsertType;
120
+ };
121
+ export type VideoState = {
122
+ sizeUnit: string;
123
+ onlyPercentage: boolean;
124
+ defaultRatio: string;
128
125
  };
129
- /**
130
- * @typedef {import('../../events').VideoInfo} VideoInfo_video
131
- */
132
- /**
133
- * @typedef {import('../../modules/Figure').FigureControls} FigureControls_video
134
- */
135
126
  /**
136
127
  * @typedef {Object} VideoPluginOptions
137
128
  * @property {boolean} [canResize=true] - Whether the video element can be resized.
138
129
  * @property {boolean} [showHeightInput=true] - Whether to display the height input field.
139
- * @property {string} [defaultWidth] - The default width of the video element. If a number is provided, "px" will be appended.
140
- * @property {string} [defaultHeight] - The default height of the video element. If a number is provided, "px" will be appended.
130
+ * @property {string} [defaultWidth] - The default width of the video element. If a number is provided, `"px"` will be appended.
131
+ * @property {string} [defaultHeight] - The default height of the video element. If a number is provided, `"px"` will be appended.
141
132
  * @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
142
133
  * @property {boolean} [createFileInput=false] - Whether to create a file input element for video uploads.
143
134
  * @property {boolean} [createUrlInput=true] - Whether to create a URL input element for video embedding.
@@ -146,18 +137,29 @@ export type VideoPluginOptions = {
146
137
  * @property {number} [uploadSizeLimit] - The total upload size limit for videos in bytes.
147
138
  * @property {number} [uploadSingleSizeLimit] - The single file upload size limit for videos in bytes.
148
139
  * @property {boolean} [allowMultiple=false] - Whether multiple video uploads are allowed.
149
- * @property {string} [acceptedFormats="video/*"] - Accepted file formats for video uploads.
140
+ * @property {string} [acceptedFormats="video/*"] - Accepted file formats for video uploads (`"video/*"`).
150
141
  * @property {number} [defaultRatio=0.5625] - The default aspect ratio for the video (e.g., 16:9 is 0.5625).
151
142
  * @property {boolean} [showRatioOption=true] - Whether to display the ratio option in the modal.
152
143
  * @property {Array} [ratioOptions] - Custom ratio options for video resizing.
153
- * @property {Object<string, string>} [videoTagAttributes] - Additional attributes to set on the video tag.
154
- * @property {Object<string, string>} [iframeTagAttributes] - Additional attributes to set on the iframe tag.
144
+ * @property {Object<string, string>} [videoTagAttributes] - Additional attributes to set on the `VIDEO` tag.
145
+ * @property {Object<string, string>} [iframeTagAttributes] - Additional attributes to set on the `IFRAME` tag.
155
146
  * @property {string} [query_youtube=""] - Additional query parameters for YouTube embedding.
156
147
  * @property {string} [query_vimeo=""] - Additional query parameters for Vimeo embedding.
157
148
  * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom query objects for additional embedding services.
158
149
  * @property {Array<RegExp>} [urlPatterns] - Additional URL patterns for video embedding.
159
150
  * @property {Array<string>} [extensions] - Additional file extensions to be recognized for video uploads.
160
- * @property {FigureControls_video} [controls] - Figure controls.
151
+ * @property {SunEditor.Module.Figure.Controls} [controls] - Figure controls.
152
+ * @property {SunEditor.ComponentInsertType} [insertBehavior] - Component insertion behavior for selection and cursor placement. [default: `options.get('componentInsertBehavior')`]
153
+ * - `auto`: Move cursor to the next line if possible, otherwise select the component.
154
+ * - `select`: Always select the inserted component.
155
+ * - `line`: Move cursor to the next line if possible, or create a new line and move there.
156
+ * - `none`: Do nothing.
157
+ */
158
+ /**
159
+ * @typedef {Object} VideoState
160
+ * @property {string} sizeUnit
161
+ * @property {boolean} onlyPercentage
162
+ * @property {string} defaultRatio
161
163
  */
162
164
  /**
163
165
  * @class
@@ -165,24 +167,27 @@ export type VideoPluginOptions = {
165
167
  * - This plugin provides video embedding functionality within the editor.
166
168
  * - It also supports embedding from popular video services
167
169
  */
168
- declare class Video extends EditorInjector {
169
- static key: string;
170
- static type: string;
171
- static className: string;
170
+ declare class Video extends PluginModal {
172
171
  /**
173
- * @this {Video}
174
172
  * @param {HTMLElement} node - The node to check.
175
173
  * @returns {HTMLElement|null} Returns a node if the node is a valid component.
176
174
  */
177
- static component(this: Video, node: HTMLElement): HTMLElement | null;
175
+ static component(node: HTMLElement): HTMLElement | null;
176
+ /**
177
+ * @description Checks if the given URL matches any of the defined URL patterns.
178
+ * @param {string} url - The URL to check.
179
+ * @returns {boolean} `true` if the URL matches a known pattern; otherwise, `false`.
180
+ */
181
+ static #checkContentType(url: string): boolean;
182
+ static #extensions: string[];
183
+ static #urlPatterns: RegExp[];
178
184
  /**
179
185
  * @constructor
180
- * @param {__se__EditorCore} editor - The root editor instance
186
+ * @param {SunEditor.Kernel} editor - The core kernel
181
187
  * @param {VideoPluginOptions} pluginOptions
182
188
  */
183
- constructor(editor: __se__EditorCore, pluginOptions: VideoPluginOptions);
189
+ constructor(editor: SunEditor.Kernel, pluginOptions: VideoPluginOptions);
184
190
  title: any;
185
- icon: string;
186
191
  pluginOptions: {
187
192
  canResize: boolean;
188
193
  showHeightInput: boolean;
@@ -210,6 +215,7 @@ declare class Video extends EditorInjector {
210
215
  };
211
216
  query_youtube: string;
212
217
  query_vimeo: string;
218
+ insertBehavior: SunEditor.ComponentInsertType;
213
219
  };
214
220
  modal: Modal;
215
221
  figure: Figure;
@@ -219,29 +225,6 @@ declare class Video extends EditorInjector {
219
225
  videoUrlFile: HTMLInputElement;
220
226
  focusElement: HTMLInputElement;
221
227
  previewSrc: HTMLElement;
222
- _linkValue: string;
223
- _align: string;
224
- _frameRatio: string;
225
- _defaultRatio: string;
226
- _defaultSizeX: string;
227
- _defaultSizeY: string;
228
- sizeUnit: string;
229
- proportion: HTMLInputElement;
230
- frameRatioOption: HTMLSelectElement;
231
- inputX: HTMLInputElement;
232
- inputY: HTMLInputElement;
233
- _element: any;
234
- _cover: HTMLElement;
235
- _container: any;
236
- _ratio: {
237
- w: number;
238
- h: number;
239
- };
240
- _origin_w: string;
241
- _origin_h: string;
242
- _resizing: boolean;
243
- _onlyPercentage: boolean;
244
- _nonResizing: boolean;
245
228
  query: {
246
229
  youtube: {
247
230
  pattern: RegExp;
@@ -254,92 +237,32 @@ declare class Video extends EditorInjector {
254
237
  tag: string;
255
238
  };
256
239
  };
257
- extensions: string[];
258
- urlPatterns: RegExp[];
259
- /**
260
- * @editorMethod Modules.Modal
261
- * @description Executes the method that is called when a "Modal" module's is opened.
262
- */
263
- open(): void;
264
- /**
265
- * @editorMethod Modules.Controller(Figure)
266
- * @description Executes the method that is called when a target component is edited.
267
- */
268
- edit(): void;
269
- /**
270
- * @editorMethod Modules.Modal
271
- * @description Executes the method that is called when a plugin's modal is opened.
272
- * @param {boolean} isUpdate "Indicates whether the modal is for editing an existing component (true) or registering a new one (false)."
273
- */
274
- on(isUpdate: boolean): void;
275
- /**
276
- * @editorMethod Editor.EventManager
277
- * @description Executes the event function of "paste" or "drop".
278
- * @param {Object} params { frameContext, event, file }
279
- * @param {__se__FrameContext} params.frameContext Frame context
280
- * @param {ClipboardEvent} params.event Event object
281
- * @param {File} params.file File object
282
- * @returns {boolean} - If return false, the file upload will be canceled
283
- */
284
- onFilePasteAndDrop({ file }: { frameContext: __se__FrameContext; event: ClipboardEvent; file: File }): boolean;
285
- /**
286
- * @editorMethod Modules.Modal
287
- * @description This function is called when a form within a modal window is "submit".
288
- * @returns {Promise<boolean>} Success / failure
289
- */
290
- modalAction(): Promise<boolean>;
240
+ /** @type {VideoState} */
241
+ state: VideoState;
242
+ sizeService: VideoSizeService;
243
+ uploadService: VideoUploadService;
291
244
  /**
292
- * @editorMethod Editor.core
293
- * @description This method is used to validate and preserve the format of the component within the editor.
294
- * - It ensures that the structure and attributes of the element are maintained and secure.
295
- * - The method checks if the element is already wrapped in a valid container and updates its attributes if necessary.
296
- * - If the element isn't properly contained, a new container is created to retain the format.
297
- * @returns {{query: string, method: (element: HTMLIFrameElement|HTMLVideoElement) => void}} The format retention object containing the query and method to process the element.
298
- * - query: The selector query to identify the relevant elements (in this case, 'audio').
299
- * - method:The function to execute on the element to validate and preserve its format.
300
- * - The function takes the element as an argument, checks if it is contained correctly, and applies necessary adjustments.
245
+ * @template {keyof VideoState} K
246
+ * @param {K} key
247
+ * @param {VideoState[K]} value
301
248
  */
249
+ setState<K extends keyof VideoState>(key: K, value: VideoState[K]): void;
302
250
  retainFormat(): {
303
251
  query: string;
304
- method: (element: HTMLIFrameElement | HTMLVideoElement) => void;
252
+ method: (element: HTMLElement) => void;
305
253
  };
306
- /**
307
- * @editorMethod Modules.Modal
308
- * @description This function is called before the modal window is opened, but before it is closed.
309
- */
310
- init(): void;
311
- /**
312
- * @editorMethod Editor.component
313
- * @description Executes the method that is called when a component of a plugin is selected.
314
- * @param {HTMLIFrameElement|HTMLVideoElement} target Target component element
315
- */
316
- select(target: HTMLIFrameElement | HTMLVideoElement): void;
317
- /**
318
- * @private
319
- * @description Prepares the component for selection.
320
- * - Ensures that the controller is properly positioned and initialized.
321
- * - Prevents duplicate event handling if the component is already selected.
322
- * @param {HTMLIFrameElement|HTMLVideoElement} target - The selected element.
323
- */
324
- private _ready;
325
- /**
326
- * @editorMethod Editor.Component
327
- * @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
328
- * @param {HTMLElement} target Target element
329
- * @returns {Promise<void>}
330
- */
331
- destroy(target: HTMLElement): Promise<void>;
332
- /**
333
- * @description Checks if the given URL matches any of the defined URL patterns.
334
- * @param {string} url - The URL to check.
335
- * @returns {boolean} True if the URL matches a known pattern; otherwise, false.
336
- */
337
- checkContentType(url: string): boolean;
254
+ onFilePasteAndDrop(params: SunEditor.HookParams.FilePasteDrop): void;
255
+ modalOn(isUpdate: boolean): void;
256
+ modalAction(): Promise<boolean>;
257
+ modalInit(): void;
258
+ componentSelect(target: HTMLElement): void | boolean;
259
+ componentEdit(target: HTMLElement): void;
260
+ componentDestroy(target: HTMLElement): Promise<void>;
338
261
  /**
339
262
  * @description Finds and processes the URL for video by matching it against known service patterns.
340
263
  * @param {string} url - The original URL.
341
- * @returns {{origin: string, url: string, tag: string}|null} An object containing the original URL, the processed URL, and the tag type (e.g., 'iframe'),
342
- * or null if no matching pattern is found.
264
+ * @returns {{origin: string, url: string, tag: string}|null} An object containing the original URL, the processed URL, and the tag type (e.g., `iframe`),
265
+ * or `null` if no matching pattern is found.
343
266
  */
344
267
  findProcessUrl(url: string): {
345
268
  origin: string;
@@ -348,7 +271,7 @@ declare class Video extends EditorInjector {
348
271
  } | null;
349
272
  /**
350
273
  * @description Converts a YouTube URL into an embeddable URL.
351
- * - If the URL does not start with "http", it prepends "https://". It also replaces "watch?v=" with the embed path.
274
+ * - If the URL does not start with `"http"`, it prepends `"https://"`. It also replaces `"watch?v="` with the embed path.
352
275
  * @param {string} url - The original YouTube URL.
353
276
  * @returns {string} The converted YouTube embed URL.
354
277
  */
@@ -362,7 +285,7 @@ declare class Video extends EditorInjector {
362
285
  convertUrlVimeo(url: string): string;
363
286
  /**
364
287
  * @description Adds query parameters to a URL.
365
- * - If the URL already contains a query string, the provided query is appended with an "&".
288
+ * - If the URL already contains a query string, the provided query is appended with an `"&"`.
366
289
  * @param {string} url - The original URL.
367
290
  * @param {string} query - The query string to append.
368
291
  * @returns {string} The URL with the appended query parameters.
@@ -379,6 +302,7 @@ declare class Video extends EditorInjector {
379
302
  * @param {string} align - The alignment to apply to the video element (e.g., 'left', 'center', 'right').
380
303
  * @param {boolean} isUpdate - Indicates whether this is an update to an existing component (true) or a new creation (false).
381
304
  * @param {{name: string, size: number}} file - File metadata associated with the video
305
+ * @param {boolean} isLast - Indicates whether this is the last file in the batch (used for scroll and insert actions).
382
306
  */
383
307
  create(
384
308
  oFrame: HTMLIFrameElement | HTMLVideoElement,
@@ -390,96 +314,40 @@ declare class Video extends EditorInjector {
390
314
  file: {
391
315
  name: string;
392
316
  size: number;
393
- }
317
+ },
318
+ isLast: boolean,
394
319
  ): void;
395
320
  /**
396
- * @description Creates a new iframe element for video embedding.
321
+ * @description Creates a new `IFRAME` element for video embedding.
397
322
  * - Applies any additional properties provided and sets the necessary attributes for embedding.
398
- * @param {Object<string, string>} [props] - An optional object containing properties to assign to the iframe.
399
- * @returns {HTMLIFrameElement} The newly created iframe element.
323
+ * @param {Object<string, string>} [props] - An optional object containing properties to assign to the `IFRAME`.
324
+ * @returns {HTMLIFrameElement} The newly created `IFRAME` element.
400
325
  */
401
326
  createIframeTag(props?: { [x: string]: string }): HTMLIFrameElement;
402
327
  /**
403
- * @description Creates a new video element for video embedding.
328
+ * @description Creates a new `VIDEO` element for video embedding.
404
329
  * - Applies any additional properties provided and sets the necessary attributes.
405
- * @param {Object<string, string>} [props] - An optional object containing properties to assign to the video element.
406
- * @returns {HTMLVideoElement} The newly created video element.
330
+ * @param {Object<string, string>} [props] - An optional object containing properties to assign to the `VIDEO` element.
331
+ * @returns {HTMLVideoElement} The newly created `VIDEO` element.
407
332
  */
408
333
  createVideoTag(props?: { [x: string]: string }): HTMLVideoElement;
409
334
  /**
410
- * @private
411
- * @description Sets the size of the video element.
412
- * @param {string|number} w - The width of the video.
413
- * @param {string|number} h - The height of the video.
414
- */
415
- private _applySize;
416
- /**
417
- * @private
418
- * @description Retrieves video information including size and alignment.
419
- * @returns {*} Video information object.
420
- */
421
- private _getInfo;
422
- /**
423
- * @description Create an "video" component using the provided files.
335
+ * @description Create a `video` component using the provided files.
424
336
  * @param {FileList|File[]} fileList File object list
425
- * @returns {Promise<boolean>} If return false, the file upload will be canceled
337
+ * @returns {Promise<boolean>} If return `false`, the file upload will be canceled
426
338
  */
427
339
  submitFile(fileList: FileList | File[]): Promise<boolean>;
428
340
  /**
429
- * @description Create an "video" component using the provided url.
341
+ * @description Create a `video` component using the provided url.
430
342
  * @param {string} url File url
431
- * @returns {Promise<boolean>} If return false, the file upload will be canceled
343
+ * @returns {Promise<boolean>} If return `false`, the file upload will be canceled
432
344
  */
433
345
  submitURL(url: string): Promise<boolean>;
434
- /**
435
- * @private
436
- * @description Updates the video component within the editor.
437
- * @param {HTMLIFrameElement|HTMLVideoElement} oFrame - The video element to update.
438
- */
439
- private _update;
440
- /**
441
- * @private
442
- * @description Registers the uploaded video in the editor.
443
- * @param {VideoInfo_video} info - Video information object.
444
- * @param {Object<string, *>} response - Server response containing video data.
445
- */
446
- private _register;
447
- /**
448
- * @private
449
- * @description Uploads a video to the server using an external upload handler.
450
- * @param {VideoInfo_video} info - Video information object.
451
- * @param {FileList} files - The video files to upload.
452
- */
453
- private _serverUpload;
454
- /**
455
- * @private
456
- * @description Sets attributes for the video tag.
457
- * @param {HTMLVideoElement} element - The video element.
458
- */
459
- private _setTagAttrs;
460
- /**
461
- * @private
462
- * @description Sets attributes for the iframe tag.
463
- * @param {HTMLIFrameElement} element - The iframe element.
464
- */
465
- private _setIframeAttrs;
466
- /**
467
- * @private
468
- * @description Selects a ratio option in the ratio dropdown.
469
- * @param {string|number} value - The selected ratio value.
470
- * @returns {boolean} Returns true if a ratio was selected.
471
- */
472
- private _setRatioSelect;
473
- /**
474
- * @private
475
- * @description Handles video upload errors.
476
- * @param {Object<string, *>} response - The error response object.
477
- * @returns {Promise<void>}
478
- */
479
- private _error;
480
346
  #private;
481
347
  }
482
- import EditorInjector from '../../editorInjector';
483
- import { Modal } from '../../modules';
484
- import { Figure } from '../../modules';
485
- import { FileManager } from '../../modules';
348
+ import { PluginModal } from '../../../interfaces';
349
+ import { Modal } from '../../../modules/contract';
350
+ import { Figure } from '../../../modules/contract';
351
+ import { FileManager } from '../../../modules/manager';
352
+ import VideoSizeService from './services/video.size';
353
+ import VideoUploadService from './services/video.upload';
@@ -0,0 +1,37 @@
1
+ import type {} from '../../../../typedef';
2
+ /**
3
+ * @typedef {object} ModalReturns_video
4
+ * @property {HTMLElement} html
5
+ * @property {HTMLElement} alignForm
6
+ * @property {HTMLElement} fileModalWrapper
7
+ * @property {HTMLInputElement} videoInputFile
8
+ * @property {HTMLInputElement} videoUrlFile
9
+ * @property {HTMLElement} previewSrc
10
+ * @property {HTMLButtonElement} galleryButton
11
+ * @property {HTMLInputElement} proportion
12
+ * @property {HTMLSelectElement} frameRatioOption
13
+ * @property {HTMLInputElement} inputX
14
+ * @property {HTMLInputElement} inputY
15
+ * @property {HTMLButtonElement} revertBtn
16
+ * @property {HTMLButtonElement} fileRemoveBtn
17
+ *
18
+ * @param {SunEditor.Deps} $
19
+ * @param {*} pluginOptions
20
+ * @returns {ModalReturns_video}
21
+ */
22
+ export function CreateHTML_modal({ lang, icons, plugins }: SunEditor.Deps, pluginOptions: any): ModalReturns_video;
23
+ export type ModalReturns_video = {
24
+ html: HTMLElement;
25
+ alignForm: HTMLElement;
26
+ fileModalWrapper: HTMLElement;
27
+ videoInputFile: HTMLInputElement;
28
+ videoUrlFile: HTMLInputElement;
29
+ previewSrc: HTMLElement;
30
+ galleryButton: HTMLButtonElement;
31
+ proportion: HTMLInputElement;
32
+ frameRatioOption: HTMLSelectElement;
33
+ inputX: HTMLInputElement;
34
+ inputY: HTMLInputElement;
35
+ revertBtn: HTMLButtonElement;
36
+ fileRemoveBtn: HTMLButtonElement;
37
+ };