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,359 +1,42 @@
1
1
  import _icons from '../../assets/icons/defaultIcons';
2
2
  import _defaultLang from '../../langs/en';
3
- import { CreateContext, CreateFrameContext } from './context';
3
+ import { CreateContext } from '../schema/context';
4
+ import { CreateFrameContext } from '../schema/frameContext';
4
5
  import { dom, numbers, converter, env } from '../../helper';
6
+ import { DEFAULTS } from '../schema/options';
5
7
 
6
8
  const _d = env._d;
7
- const DEFAULT_BUTTON_LIST = [
8
- ['undo', 'redo'],
9
- '|',
10
- ['bold', 'underline', 'italic', 'strike', '|', 'subscript', 'superscript'],
11
- '|',
12
- ['removeFormat'],
13
- '|',
14
- ['outdent', 'indent'],
15
- '|',
16
- ['fullScreen', 'showBlocks', 'codeView'],
17
- '|',
18
- ['preview', 'print']
19
- ];
20
-
21
- const REQUIRED_FORMAT_LINE = 'div';
22
- const REQUIRED_ELEMENT_WHITELIST = 'br|div';
23
- const DEFAULT_ELEMENT_WHITELIST =
24
- 'p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary';
25
- const DEFAULT_TEXT_STYLE_TAGS = 'strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary';
26
-
27
- /* scopeSelectionTags */
28
- const DEFAULT_SCOPE_SELECTION_TAGS = 'td|table|li|ol|ul|pre|figcaption|blockquote|dl|dt|dd';
29
-
30
- const _media_attr = '|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList';
31
- const _iframe_attr = '|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling';
32
- const DEFAULT_ATTRIBUTE_WHITELIST = 'contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan' + _media_attr + _iframe_attr;
33
-
34
- const DEFAULT_FORMAT_LINE = 'P|H[1-6]|LI|TH|TD|DETAILS';
35
- const DEFAULT_FORMAT_BR_LINE = 'PRE';
36
- const DEFAULT_FORMAT_CLOSURE_BR_LINE = '';
37
- const DEFAULT_FORMAT_BLOCK = 'BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS';
38
- const DEFAULT_FORMAT_CLOSURE_BLOCK = 'TH|TD';
39
-
40
- const DEFAULT_ALLOWED_EMPTY_NODE_LIST = '.se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details';
41
-
42
- const DEFAULT_SIZE_UNITS = ['px', 'pt', 'em', 'rem'];
43
-
44
- const DEFAULT_CLASS_NAME = '^__se__|^se-|^katex|^MathJax';
45
- const DEFAULT_CLASS_MJX = 'mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover';
46
- const DEFAULT_EXTRA_TAG_MAP = { script: false, style: false, meta: false, link: false, '[a-z]+:[a-z]+': false };
47
-
48
- const DEFAULT_CONTENT_STYLES =
49
- 'background|background-clip|background-color|' +
50
- 'border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|' +
51
- 'box-shadow|box-sizing|' +
52
- 'caption-side|color|content|' +
53
- 'direction|display|' +
54
- 'float|font|font-family|font-size|font-style|font-weight|' +
55
- 'height|' +
56
- 'left|letter-spacing|line-height|list-style-position|list-style-type|' +
57
- 'margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|max-width|min-width|' +
58
- 'outline|overflow|' +
59
- 'position|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|' +
60
- 'page-break-before|page-break-after|page-break-inside|' +
61
- 'rotate|rotateX|rotateY|' +
62
- 'table-layout|text-align|text-decoration|text-shadow|text-transform|top|' +
63
- 'text-indent|text-rendering|' +
64
- 'vertical-align|visibility|' +
65
- 'white-space|width|word-break|word-wrap';
66
- const DEFAULT_TAG_STYLES = {
67
- 'table|th|td': 'border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align|text-align',
68
- 'table|td': 'width',
69
- tr: 'height',
70
- col: 'width',
71
- 'ol|ul': 'list-style-type'
72
- };
73
- const DEFAULT_TEXT_STYLES = 'font-family|font-size|color|background-color';
74
- const DEFAULT_LINE_STYLES = 'text-align|margin-left|margin-right|line-height';
75
-
76
- const RETAIN_STYLE_MODE = ['repeat', 'always', 'none'];
77
9
 
78
10
  /**
79
- * @typedef {Object} EditorFrameOptions
80
- * @property {string} [value=""] - Initial value for the editor.
81
- * @property {string} [placeholder=""] - Placeholder text.
82
- * @property {Object<string, string>} [editableFrameAttributes={}] - Attributes for the editable frame[.sun-editor-editable]. (e.g. [key]: value)
83
- * @property {string} [width="100%"] - Width for the editor.
84
- * @property {string} [minWidth=""] - Min width for the editor.
85
- * @property {string} [maxWidth=""] - Max width for the editor.
86
- * @property {string} [height="auto"] - Height for the editor.
87
- * @property {string} [minHeight=""] - Min height for the editor.
88
- * @property {string} [maxHeight=""] - Max height for the editor.
89
- * @property {string} [editorStyle=""] - Style string of the top frame of the editor. (e.g. "border: 1px solid #ccc;").
90
- * @property {boolean} [iframe=false] - Content will be placed in an iframe and isolated from the rest of the page.
91
- * @property {boolean} [iframe_fullPage=false] - Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration on the "iframe".
92
- * @property {Object<string, string>} [iframe_attributes={}] - Attributes of the "iframe". (e.g. {'scrolling': 'no'})
93
- * @property {string} [iframe_cssFileName="suneditor"] - Name or Array of the CSS file to apply inside the iframe.
94
- * - You can also use regular expressions.
95
- * - Applied by searching by filename in the link tag of document,
96
- * - or put the URL value (".css" can be omitted).
97
- * @property {boolean} [statusbar=true] - Enables the status bar.
98
- * @property {boolean} [statusbar_showPathLabel=true] - Displays the current node structure to status bar.
99
- * @property {boolean} [statusbar_resizeEnable=true] - Enables resize function of bottom status bar
100
- * @property {boolean} [charCounter=false] - Shows the number of characters in the editor.
101
- * - If the maxCharCount option has a value, it becomes true.
102
- * @property {number} [charCounter_max] - The maximum number of characters allowed to be inserted into the editor.
103
- * @property {string} [charCounter_label] - Text to be displayed in the "charCounter" area of the bottom bar. (e.g. "Characters : 20/200")
104
- * @property {"char"|"byte"|"byte-html"} [charCounter_type="char"] - Defines the calculation method of the "charCounter" option.
105
- * - 'char': Characters length.
106
- * - 'byte': Binary data size of characters.
107
- * - 'byte-html': Binary data size of the full HTML string.
11
+ * @typedef {import('../schema/options').AllBaseOptions} AllBaseOptions_constructor
108
12
  */
109
13
 
110
14
  /**
111
- * @typedef {Object} EditorBaseOptions
112
- * @property {Object<string, *>|Array<Object<string, *>>} [plugins] - Plugin configuration.
113
- * @property {Array<string>} [excludedPlugins] - Plugin configuration.
114
- * @property {Array<string[]|string>} [buttonList] - List of toolbar buttons, grouped by sub-arrays.
115
- * @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
116
- * @property {boolean|{tagFilter: boolean, formatFilter: boolean, classFilter: boolean, styleNodeFilter: boolean, attrFilter: boolean, styleFilter: boolean}} [strictMode=true] - Enables strict filtering of tags, attributes, and styles.
117
- * @property {"classic"|"inline"|"balloon"|"balloon-always"} [mode="classic"] - Toolbar mode: "classic", "inline", "balloon", "balloon-always".
118
- * @property {string} [type=""] - Editor type: "document:header,page".
119
- * @property {string} [theme=""] - Editor theme.
120
- * @property {Object<string, string>} [lang] - Language configuration.
121
- * @property {Array<string>} [fontSizeUnits=["px", "pt", "em", "rem"]] - Allowed font size units.
122
- * @property {string} [allowedClassName] - Allowed class names.
123
- * @property {boolean} [closeModalOutsideClick=false] - Closes modals when clicking outside.
124
- * @property {boolean} [copyFormatKeepOn=false] - Keeps the format of the copied content.
125
- * @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
126
- * @property {boolean} [tabDisable=false] - Disables tab key input.
127
- * @property {boolean} [autoLinkify] - Automatically converts URLs into hyperlinks. ("Link" plugin required)
128
- * @property {Array<string>} [autoStyleify=["bold", "underline", "italic", "strike"]] - Styles applied automatically on text input.
129
- * @property {Object<string, string|number>} [scrollToOptions={behavior: "auto", block: "nearest"}] - Configuration for scroll behavior when navigating editor content.
130
- * @property {Object<string, string|number>} [componentScrollToOptions={behavior: "smooth", block: "center"}] - Configuration for scroll behavior when navigating components.
131
- * @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - This option determines how inline elements (such as <span>, <strong>, etc.) are handled when deleting text.
132
- * - "repeat": Inline styles are retained unless the backspace key is repeatedly pressed. If the user continuously presses backspace, the styles will eventually be removed.
133
- * - "none": Inline styles are not retained at all. When deleting text, the associated inline elements are immediately removed along with it.
134
- * - "always": Inline styles persist indefinitely unless explicitly removed. Even if all text inside an inline element is deleted, the element itself remains until manually removed.
135
- * @property {Object<string, boolean>} [allowedExtraTags={script: false, style: false, meta: false, link: false, "[a-z]+:[a-z]+": false}] - Specifies extra allowed or disallowed tags.
136
- * @property {Object<string, (...args: *) => *>} [events={}] - Custom event handlers.
137
- * @property {string} [__textStyleTags="strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary"] - The basic tags that serves as the base for "textStyleTags"
138
- * @property {string} [textStyleTags="strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary"] - Additional text style tags.
139
- * @property {Object<string, string>} [convertTextTags={bold: "strong", underline: "u", italic: "em", strike: "del", subscript: "sub", superscript: "sup"}] - Maps text styles to specific HTML tags.
140
- * @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles. Delimiter: "|" (e.g. "color|background-color").
141
- * @property {Object<string, string>} [__tagStyles={
142
- 'table|th|td': 'border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align|text-align',
143
- 'table|td': 'width',
144
- tr: 'height',
145
- col: 'width',
146
- 'ol|ul': 'list-style-type'
147
- }] - The basic tags that serves as the base for "tagStyles"
148
- * @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles for HTML tags.
149
- * @property {string} [spanStyles="font-family|font-size|color|background-color"] - Specifies allowed styles for the "span" tag.
150
- * @property {string} [lineStyles="text-align|margin-left|margin-right|line-height"] - Specifies allowed styles for the "line" element (p..).
151
- * @property {string} [textDirection="ltr"] - Text direction: "ltr" or "rtl".
152
- * @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other, depending on the "textDirection" mode.
153
- * @property {number} [historyStackDelayTime=400] - Delay time for history stack updates (ms).
154
- * @property {string} [lineAttrReset=""] - Line properties that should be reset when changing lines (e.g. "id|name").
155
- * @property {string} [printClass=""] - Class name for printing.
156
- * @property {string} [defaultLine="p"] - Default line element when inserting new lines.
157
- * @property {"line"|"br"} [defaultLineBreakFormat="line"] - Specifies the default line break format.
158
- * - [Recommended] "line" : is a line break that is divided into general tags.
159
- * - [Not recommended] "br" : Line breaks are treated as <br> on the same line. (like shift+enter)
160
- * - Line breaks are handled as <br> within "line".
161
- * - You can create a new "line" by entering a line break twice in a row.
162
- * - Formats that include "line", such as "Quote", still operate on a "line" basis.
163
- * - ● suneditor processes work in "line" units.
164
- * - ● When set to "br", performance may decrease when editing a lot of data.
165
- * @property {Array<string>} [scopeSelectionTags=["td", "table", "li", "ol", "ul", "pre", "figcaption", "blockquote", "dl", "dt", "dd"]] - Tags treated as whole units when selecting all content.
166
- * @property {string} [__defaultElementWhitelist="br|div"] - Default allowed HTML elements. The default values are maintained.
167
- * @property {string} [elementWhitelist=""] - Allowed HTML elements. Delimiter: "|" (e.g. "p|div", "*").
168
- * @property {string} [elementBlacklist=""] - Disallowed HTML elements. Delimiter: "|" (e.g. "script|style").
169
- * @property {string} [__defaultAttributeWhitelist] - Allowed attributes. Delimiter: "|" (e.g. "href|target").
170
- * @property {Object<string, string>} [attributeWhitelist=""] - Allowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
171
- * @property {Object<string, string>} [attributeBlacklist=""] - Disallowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
172
- * @property {string} [__defaultFormatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Overrides the editor's default "line" element.
173
- * @property {string} [formatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Specifies the editor's "line" elements.
174
- * - (P, DIV, H[1-6], PRE, LI | class="__se__format__line_xxx")
175
- * - "line" element also contain "brLine" element
176
- * @property {string} [__defaultFormatBrLine="PRE"] - Overrides the editor's default "brLine" element.
177
- * @property {string} [formatBrLine="PRE"] - Specifies the editor's "brLine" elements. (e.g. "PRE").
178
- * - (PRE | class="__se__format__br_line_xxx")
179
- * - "brLine" elements is included in the "line" element.
180
- * - "brLine" elements's line break is "BR" tag.
181
- * ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
182
- * @property {string} [__defaultFormatClosureBrLine=""] - Overrides the editor's default "closureBrLine" element.
183
- * @property {string} [formatClosureBrLine=""] - Specifies the editor's "closureBrLine" elements.
184
- * - (class="__se__format__br_line__closure_xxx")
185
- * - "closureBrLine" elements is included in the "brLine".
186
- * - "closureBrLine" elements's line break is "BR" tag.
187
- * - ※ You cannot exit this format with the Enter key or Backspace key.
188
- * - ※ Use it only in special cases. ([ex] format of table cells)
189
- * @property {string} [__defaultFormatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Overrides the editor's default "block" element.
190
- * @property {string} [formatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Specifies the editor's "block" elements.
191
- * - (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__block_xxx")
192
- * - "block" is wrap the "line" and "component"
193
- * @property {string} [__defaultFormatClosureBlock="TH|TD"] - Overrides the editor's default "closureBlock" element.
194
- * @property {string} [formatClosureBlock="TH|TD"] - Specifies the editor's "closureBlock" elements.
195
- * - (TH, TD | class="__se__format__block_closure_xxx")
196
- * - "closureBlock" elements is included in the "block".
197
- * - "closureBlock" element is wrap the "line" and "component"
198
- * - ※ You cannot exit this format with the Enter key or Backspace key.
199
- * - ※ Use it only in special cases. ([ex] format of table cells)
200
- * @property {string} [allowedEmptyTags=".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details"] - Allowed empty tags.
201
- * @property {number|string} [toolbar_width="auto"] - Toolbar width.
202
- * @property {Element|string} [toolbar_container] - Container element for the toolbar.
203
- * @property {number} [toolbar_sticky=0] - Enables sticky toolbar with optional offset.
204
- * @property {boolean} [toolbar_hide=false] - Hides toolbar initially.
205
- * @property {Object} [subToolbar] - Sub-toolbar configuration.
206
- * @property {Array<Array<string>>} [subToolbar.buttonList] - List of Sub-toolbar buttons, grouped by sub-arrays.
207
- * @property {"balloon"|"balloon-always"} [subToolbar.mode="balloon"] - Sub-toolbar mode: "balloon", "balloon-always".
208
- * @property {number|string} [subToolbar.width="auto"] - Sub-toolbar width.
209
- * @property {Element|string} [statusbar_container] - Container element for the status bar.
210
- * @property {boolean} [shortcutsHint=true] - Displays shortcut hints in tooltips.
211
- * @property {boolean} [shortcutsDisable=false] - Disables keyboard shortcuts.
212
- * @property {Object<string, Array<string>>} [shortcuts] - Custom keyboard shortcuts.
213
- * @property {number} [fullScreenOffset=0] - Offset applied when entering fullscreen mode.
214
- * @property {string} [previewTemplate] - Custom template for preview mode.
215
- * @property {string} [printTemplate] - Custom template for print mode.
216
- * @property {boolean} [componentAutoSelect=false] - Enables automatic selection of inserted components.
217
- * @property {string} [defaultUrlProtocol] - Default URL protocol for links.
218
- * @property {Object<"copy", number>} [toastMessageTime] - {"copy": 1500} - Duration for displaying toast messages.
219
- * @property {Object<string, string>} [icons] - Overrides the default icons.
220
- * @property {string} [freeCodeViewMode=false] - Enables free code view mode.
221
- * @property {boolean} [__lineFormatFilter=true] - Line format filter configuration.
222
- * @property {boolean} [__pluginRetainFilter=true] - Plugin retain filter configuration.
223
- * @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the list of styles that are applied directly to the `<li>` element
224
- * - when a text style is applied to the entire list item.
225
- * - For example, when changing the font size or color of a list item (`<li>`),
226
- * - these styles will be applied to the `<li>` tag instead of wrapping the content inside additional tags.
227
- * @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
228
- *
229
- * @property {Object<string, *>} [Dynamic_pluginOptions] - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
15
+ * @typedef {Object} ConstructorReturnType
16
+ * @property {SunEditor.Context} context - Editor context object
17
+ * @property {HTMLElement} carrierWrapper - Carrier wrapper element
18
+ * @property {Map<string, *>} options - Processed editor options (`Map`)
19
+ * @property {Object<string, *>} plugins - Loaded plugins
20
+ * @property {Object<string, string>} icons - Icon set
21
+ * @property {Object<string, string>} lang - Language pack
22
+ * @property {?string} value - Initial editor value
23
+ * @property {?string} rootId - Root frame ID
24
+ * @property {Array<string|null>} rootKeys - Array of frame keys
25
+ * @property {Map<string|null, ReturnType<import('../schema/frameContext').CreateFrameContext>>} frameRoots - Map of frame contexts
26
+ * @property {Object<string, Array<HTMLElement>>} pluginCallButtons - Plugin toolbar buttons
27
+ * @property {Array<HTMLElement>} responsiveButtons - Responsive toolbar buttons
28
+ * @property {Object<string, Array<HTMLElement>>|[]} pluginCallButtons_sub - Sub-toolbar plugin buttons
29
+ * @property {Array<HTMLElement>} responsiveButtons_sub - Sub-toolbar responsive buttons
230
30
  */
231
31
 
232
- /**
233
- * @typedef {EditorBaseOptions & EditorFrameOptions} EditorInitOptions
234
- */
235
-
236
- /** ------------- [OPTIONS FRAG] ------------- */
237
- /**
238
- * @description For all EditorInitOptions keys, only boolean | null values are allowed.
239
- * - 'fixed' → Immutable / null → Resettable.
240
- * @type {Partial<Record<keyof EditorInitOptions, "fixed" | true>>}
241
- */
242
- export const OPTION_FRAME_FIXED_FLAG = {
243
- value: 'fixed',
244
- placeholder: true,
245
- editableFrameAttributes: true,
246
- width: true,
247
- minWidth: true,
248
- maxWidth: true,
249
- height: true,
250
- minHeight: true,
251
- maxHeight: true,
252
- editorStyle: true,
253
- iframe: 'fixed',
254
- iframe_fullPage: 'fixed',
255
- iframe_attributes: true,
256
- iframe_cssFileName: true,
257
- statusbar: true,
258
- statusbar_showPathLabel: true,
259
- statusbar_resizeEnable: 'fixed',
260
- charCounter: true,
261
- charCounter_max: true,
262
- charCounter_label: true,
263
- charCounter_type: true
264
- };
265
- /**
266
- * @description For all EditorInitOptions keys, only boolean | null values are allowed.
267
- * - 'fixed' → Immutable / null → Resettable.
268
- * @type {Partial<Record<keyof EditorInitOptions, "fixed" | true>>}
269
- */
270
- export const OPTION_FIXED_FLAG = {
271
- plugins: 'fixed',
272
- excludedPlugins: 'fixed',
273
- buttonList: 'fixed',
274
- v2Migration: 'fixed',
275
- strictMode: 'fixed',
276
- mode: 'fixed',
277
- type: 'fixed',
278
- theme: true,
279
- lang: 'fixed',
280
- fontSizeUnits: 'fixed',
281
- allowedClassName: 'fixed',
282
- closeModalOutsideClick: 'fixed',
283
- copyFormatKeepOn: true,
284
- syncTabIndent: true,
285
- tabDisable: true,
286
- autoLinkify: true,
287
- autoStyleify: true,
288
- scrollToOptions: true,
289
- componentScrollToOptions: true,
290
- retainStyleMode: true,
291
- allowedExtraTags: 'fixed',
292
- events: true,
293
- __textStyleTags: 'fixed',
294
- textStyleTags: 'fixed',
295
- convertTextTags: 'fixed',
296
- __tagStyles: 'fixed',
297
- tagStyles: 'fixed',
298
- spanStyles: 'fixed',
299
- lineStyles: 'fixed',
300
- textDirection: true,
301
- reverseButtons: 'fixed',
302
- historyStackDelayTime: true,
303
- lineAttrReset: true,
304
- printClass: true,
305
- defaultLine: 'fixed',
306
- defaultLineBreakFormat: true,
307
- scopeSelectionTags: true,
308
- __defaultElementWhitelist: 'fixed',
309
- elementWhitelist: 'fixed',
310
- elementBlacklist: 'fixed',
311
- __defaultAttributeWhitelist: 'fixed',
312
- attributeWhitelist: 'fixed',
313
- attributeBlacklist: 'fixed',
314
- __defaultFormatLine: 'fixed',
315
- formatLine: 'fixed',
316
- __defaultFormatBrLine: 'fixed',
317
- formatBrLine: 'fixed',
318
- __defaultFormatClosureBrLine: 'fixed',
319
- formatClosureBrLine: 'fixed',
320
- __defaultFormatBlock: 'fixed',
321
- formatBlock: 'fixed',
322
- __defaultFormatClosureBlock: 'fixed',
323
- formatClosureBlock: 'fixed',
324
- allowedEmptyTags: true,
325
- toolbar_width: true,
326
- toolbar_container: 'fixed',
327
- toolbar_sticky: true,
328
- toolbar_hide: true,
329
- subToolbar: 'fixed',
330
- statusbar_container: 'fixed',
331
- shortcutsHint: true,
332
- shortcutsDisable: 'fixed',
333
- shortcuts: 'fixed',
334
- fullScreenOffset: true,
335
- previewTemplate: true,
336
- printTemplate: true,
337
- componentAutoSelect: true,
338
- defaultUrlProtocol: true,
339
- allUsedStyles: 'fixed',
340
- toastMessageTime: true,
341
- icons: 'fixed',
342
- freeCodeViewMode: true,
343
- __lineFormatFilter: true,
344
- __pluginRetainFilter: true,
345
- __listCommonStyle: 'fixed',
346
- externalLibs: 'fixed'
347
- };
348
-
349
32
  /**
350
33
  * @description Creates a new SunEditor instance with specified options.
351
- * @param {Array<{target: Element, key: *, options: EditorFrameOptions}>} editorTargets - Target element or multi-root object.
352
- * @param {EditorInitOptions} options - Configuration options for the editor.
353
- * @returns {Object<string, *>} - SunEditor instance with context, options, and DOM elements.
34
+ * @param {Array<{target: Element, key: *, options: SunEditor.InitFrameOptions}>} editorTargets - Target element or multi-root object.
35
+ * @param {SunEditor.InitOptions} options - Configuration options for the editor.
36
+ * @returns {ConstructorReturnType} - SunEditor instance with context, options, and DOM elements.
354
37
  */
355
38
  function Constructor(editorTargets, options) {
356
- if (typeof options !== 'object') options = {};
39
+ if (typeof options !== 'object') options = /** @type {SunEditor.InitOptions} */ ({});
357
40
 
358
41
  /** --- Plugins ------------------------------------------------------------------------------------------ */
359
42
  const plugins = {};
@@ -384,7 +67,7 @@ function Constructor(editorTargets, options) {
384
67
  const focusTemp = /** @type {HTMLInputElement} */ (
385
68
  dom.utils.createElement('INPUT', {
386
69
  class: '__se__focus__temp__',
387
- style: 'position: fixed !important; top: -10000px !important; left: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;'
70
+ style: 'position: fixed !important; top: -10000px !important; left: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;',
388
71
  })
389
72
  );
390
73
  focusTemp.tabIndex = 0;
@@ -440,7 +123,7 @@ function Constructor(editorTargets, options) {
440
123
  subbar.style.visibility = 'hidden';
441
124
  // subbar mode must be balloon-*
442
125
  subbar.className += ' se-toolbar-balloon se-toolbar-sub';
443
- subbar.style.width = o.get('toolbar.sub_width');
126
+ subbar.style.width = o.get('toolbar_sub_width');
444
127
  subbar.appendChild(dom.utils.createElement('DIV', { class: 'se-arrow' }));
445
128
  }
446
129
 
@@ -524,9 +207,9 @@ function Constructor(editorTargets, options) {
524
207
  'DIV',
525
208
  {
526
209
  class: 'sun-editor-editable se-document-page-mirror-a4',
527
- style: `position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;`
210
+ style: `position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;`,
528
211
  },
529
- null
212
+ null,
530
213
  );
531
214
  }
532
215
 
@@ -567,18 +250,18 @@ function Constructor(editorTargets, options) {
567
250
  pluginCallButtons: tool_bar_main.pluginCallButtons,
568
251
  responsiveButtons: tool_bar_main.responsiveButtons,
569
252
  pluginCallButtons_sub: sub_main ? sub_main.pluginCallButtons : [],
570
- responsiveButtons_sub: sub_main ? sub_main.responsiveButtons : []
253
+ responsiveButtons_sub: sub_main ? sub_main.responsiveButtons : [],
571
254
  };
572
255
  }
573
256
 
574
257
  /**
575
258
  * @description Create shortcuts desc span.
576
259
  * @param {string} command Command string
577
- * @param {Array<string>} values options.shortcuts[command]
578
- * @param {Element|null} button Command button element
260
+ * @param {Array<string>} values `options.shortcuts[command]`
261
+ * @param {?Element} button Command button element
579
262
  * @param {Map<string, *>} keyMap Map to store shortcut key info
580
- * @param {Array} rc "_reverseCommandArray" option
581
- * @param {Array} reverseKeys Reverse key array
263
+ * @param {Array} rc `_reverseCommandArray` option
264
+ * @param {Set} reverseKeys Reverse key array
582
265
  */
583
266
  export function CreateShortcuts(command, button, values, keyMap, rc, reverseKeys) {
584
267
  if (!values || values.length < 2) return;
@@ -589,7 +272,7 @@ export function CreateShortcuts(command, button, values, keyMap, rc, reverseKeys
589
272
  a = values[i].split('+');
590
273
 
591
274
  plugin = null;
592
- method = a[a.length - 1].trim?.();
275
+ method = a.at(-1).trim?.();
593
276
  if (method.startsWith('~')) {
594
277
  // plugin key, method
595
278
  plugin = command;
@@ -639,7 +322,7 @@ export function CreateShortcuts(command, button, values, keyMap, rc, reverseKeys
639
322
  if (!keyMap.has(k)) {
640
323
  r = rc.indexOf(command);
641
324
  r = r === -1 ? '' : numbers.isOdd(r) ? rc[r + 1] : rc[r - 1];
642
- if (r) reverseKeys.push(k);
325
+ if (r) reverseKeys.add(k);
643
326
 
644
327
  keyMap.set(k, { c, s, edge, space, enter, textTrigger, plugin, command, method, r, type: button?.getAttribute('data-type'), button, key: k });
645
328
  }
@@ -655,8 +338,7 @@ function _addTooltip(tooptipBtn, shift, shortcut) {
655
338
  }
656
339
 
657
340
  /**
658
- * @private
659
- * @description Returns a new object with merge "a" and "b"
341
+ * @description Returns a new object with merge `a` and `b`
660
342
  * @param {Object<*, *>} a object
661
343
  * @param {Object<*, *>} b object
662
344
  * @returns {Object<*, *>} new object
@@ -670,23 +352,27 @@ function _mergeObject(a, b) {
670
352
  }, {});
671
353
  }
672
354
 
355
+ /**
356
+ * @typedef {Object} InitOptionsReturnType
357
+ * @property {Map<string, *>} o - Processed base options (`Map` containing {@link AllBaseOptions_constructor} keys)
358
+ * @property {Object<string, string>} i - Icon set
359
+ * @property {Object<string, string>} l - Language pack
360
+ * @property {?string} v - Initial editor value
361
+ * @property {SunEditor.UI.ButtonList} buttons - Toolbar button list (arrays for groups, strings for single buttons)
362
+ * @property {?SunEditor.UI.ButtonList} subButtons - Sub-toolbar button list
363
+ * @property {?Element} statusbarContainer - Container element for status bar (if specified)
364
+ * @property {Map<string|null, SunEditor.FrameOptions>} frameMap - Map of frame-specific options (frame key => `SunEditor.FrameOptions`)
365
+ */
366
+
673
367
  /**
674
368
  * @description Initialize options
675
- * @param {EditorInitOptions} options Configuration options for the editor.
676
- * @param {Array<{target: Element, key: *, options: EditorFrameOptions}>} editorTargets Target textarea
369
+ * @param {SunEditor.InitOptions} options Configuration options for the editor.
370
+ * @param {Array<{target: Element, key: *, options: SunEditor.InitFrameOptions}>} editorTargets Target textarea
677
371
  * @param {Object<string, *>} plugins Plugins object
678
- * @returns {{o: Map<string, *>, i: Object<string, string>, l: Object<string, string>, v: string, buttons: Array<string[]|string>, subButtons: Array<string[]|string>, statusbarContainer: Element|null, frameMap: Map<*, *>}}
679
- * - o: options
680
- * - i: icons
681
- * - l: lang
682
- * - v: value
683
- * - buttons: Toolbar button list
684
- * - subButtons: Sub-Toolbar button list
685
- * - statusbarContainer: statusbar container
686
- * - frameMap: converted options map
372
+ * @returns {InitOptionsReturnType} Initialized options and configuration
687
373
  */
688
374
  export function InitOptions(options, editorTargets, plugins) {
689
- const buttonList = options.buttonList || DEFAULT_BUTTON_LIST;
375
+ const buttonList = options.buttonList || DEFAULTS.BUTTON_LIST;
690
376
  const o = new Map();
691
377
 
692
378
  /** Multi root */
@@ -699,15 +385,14 @@ export function InitOptions(options, editorTargets, plugins) {
699
385
 
700
386
  /** Base */
701
387
  o.set('buttons', new Set(buttonList.toString().split(',')));
702
- const modeValue = options.strictMode !== false;
703
388
  o.set('strictMode', {
704
- tagFilter: modeValue,
705
- formatFilter: modeValue,
706
- classFilter: modeValue,
707
- styleNodeFilter: modeValue,
708
- attrFilter: modeValue,
709
- styleFilter: modeValue,
710
- ...(typeof options.strictMode === 'boolean' ? {} : options.strictMode)
389
+ tagFilter: true,
390
+ formatFilter: true,
391
+ classFilter: true,
392
+ textStyleTagFilter: true,
393
+ attrFilter: true,
394
+ styleFilter: true,
395
+ ...(typeof options.strictMode === 'boolean' ? {} : options.strictMode),
711
396
  });
712
397
  o.set('freeCodeViewMode', !!options.freeCodeViewMode);
713
398
  o.set('__lineFormatFilter', options.__lineFormatFilter ?? true);
@@ -718,8 +403,8 @@ export function InitOptions(options, editorTargets, plugins) {
718
403
  o.set('_themeClass', options.theme ? ` se-theme-${options.theme}` : '');
719
404
  o.set('_type_options', options.type?.split(':')[1] || '');
720
405
  o.set('externalLibs', options.externalLibs || {});
721
- o.set('fontSizeUnits', Array.isArray(options.fontSizeUnits) && options.fontSizeUnits.length > 0 ? options.fontSizeUnits.map((v) => v.toLowerCase()) : DEFAULT_SIZE_UNITS);
722
- o.set('allowedClassName', new RegExp(`${options.allowedClassName && typeof options.allowedClassName === 'string' ? options.allowedClassName + '|' : ''}${DEFAULT_CLASS_NAME}`));
406
+ o.set('fontSizeUnits', Array.isArray(options.fontSizeUnits) && options.fontSizeUnits.length > 0 ? options.fontSizeUnits.map((v) => v.toLowerCase()) : DEFAULTS.SIZE_UNITS);
407
+ o.set('allowedClassName', new RegExp(`${options.allowedClassName && typeof options.allowedClassName === 'string' ? options.allowedClassName + '|' : ''}${DEFAULTS.CLASS_NAME}`));
723
408
  o.set('closeModalOutsideClick', !!options.closeModalOutsideClick);
724
409
 
725
410
  // format
@@ -730,18 +415,14 @@ export function InitOptions(options, editorTargets, plugins) {
730
415
  o.set('autoLinkify', options.autoLinkify ?? !!plugins.link);
731
416
  o.set('autoStyleify', Array.isArray(options.autoStyleify) ? options.autoStyleify : ['bold', 'underline', 'italic', 'strike']);
732
417
 
733
- // scroll options
734
- o.set('scrollToOptions', { behavior: 'auto', block: 'nearest', ...options.scrollToOptions });
735
- o.set('componentScrollToOptions', { behavior: 'smooth', block: 'center', ...options.componentScrollToOptions });
736
-
737
- let retainStyleMode = options.retainStyleMode;
738
- if (typeof retainStyleMode === 'string' && !RETAIN_STYLE_MODE.includes(retainStyleMode)) {
739
- console.error(`Invalid retainStyleMode: ${retainStyleMode}. Valid options are ${RETAIN_STYLE_MODE.join(', ')}. Using default 'once'.`);
418
+ let retainStyleMode = options.retainStyleMode || 'repeat';
419
+ if (typeof retainStyleMode === 'string' && !DEFAULTS.RETAIN_STYLE_MODE.includes(retainStyleMode)) {
420
+ console.error(`Invalid retainStyleMode: ${retainStyleMode}. Valid options are ${DEFAULTS.RETAIN_STYLE_MODE.join(', ')}. Using default 'repeat'.`);
740
421
  retainStyleMode = 'repeat';
741
422
  }
742
423
  o.set('retainStyleMode', retainStyleMode);
743
424
 
744
- const allowedExtraTags = { ...DEFAULT_EXTRA_TAG_MAP, ...options.allowedExtraTags, '-': true };
425
+ const allowedExtraTags = { ...DEFAULTS.EXTRA_TAG_MAP, ...options.allowedExtraTags, '-': true };
745
426
  const extraKeys = Object.keys(allowedExtraTags);
746
427
  const allowedKeys = extraKeys.filter((k) => allowedExtraTags[k]).join('|');
747
428
  const disallowedKeys = extraKeys.filter((k) => !allowedExtraTags[k]).join('|');
@@ -751,7 +432,7 @@ export function InitOptions(options, editorTargets, plugins) {
751
432
  o.set('events', options.events || {});
752
433
 
753
434
  // text style tags
754
- o.set('textStyleTags', (typeof options.__textStyleTags === 'string' ? options.__textStyleTags : DEFAULT_TEXT_STYLE_TAGS) + (options.textStyleTags ? '|' + options.textStyleTags : ''));
435
+ o.set('textStyleTags', (typeof options.__textStyleTags === 'string' ? options.__textStyleTags : DEFAULTS.TEXT_STYLE_TAGS) + (options.textStyleTags ? '|' + options.textStyleTags : ''));
755
436
  const textTags = _mergeObject(
756
437
  {
757
438
  bold: 'strong',
@@ -759,23 +440,23 @@ export function InitOptions(options, editorTargets, plugins) {
759
440
  italic: 'em',
760
441
  strike: 'del',
761
442
  subscript: 'sub',
762
- superscript: 'sup'
443
+ superscript: 'sup',
763
444
  },
764
- options.convertTextTags || {}
445
+ options.convertTextTags || {},
765
446
  );
766
447
  o.set('convertTextTags', textTags);
767
448
  o.set('_textStyleTags', Object.values(textTags).concat(['span', 'li']));
768
449
  o.set(
769
450
  'tagStyles',
770
- [{ ...DEFAULT_TAG_STYLES, ...(options.__tagStyles || {}) }, options.tagStyles || {}].reduce((_default, _new) => {
451
+ [{ ...DEFAULTS.TAG_STYLES, ...(options.__tagStyles || {}) }, options.tagStyles || {}].reduce((_default, _new) => {
771
452
  for (const key in _new) {
772
453
  _default[key] = _new[key];
773
454
  }
774
455
  return _default;
775
- }, {})
456
+ }, {}),
776
457
  );
777
- o.set('_textStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULT_TEXT_STYLES}${options.spanStyles ? '|' + options.spanStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
778
- o.set('_lineStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULT_LINE_STYLES}${options.lineStyles ? '|' + options.lineStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
458
+ o.set('_textStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULTS.SPAN_STYLES}${options.spanStyles ? '|' + options.spanStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
459
+ o.set('_lineStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULTS.LINE_STYLES}${options.lineStyles ? '|' + options.lineStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
779
460
  o.set('_defaultStyleTagMap', {
780
461
  strong: textTags.bold,
781
462
  b: textTags.bold,
@@ -787,7 +468,7 @@ export function InitOptions(options, editorTargets, plugins) {
787
468
  strike: textTags.strike,
788
469
  s: textTags.strike,
789
470
  sub: textTags.subscript,
790
- sup: textTags.superscript
471
+ sup: textTags.superscript,
791
472
  });
792
473
  o.set(
793
474
  '_styleCommandMap',
@@ -802,8 +483,8 @@ export function InitOptions(options, editorTargets, plugins) {
802
483
  strike: 'strike',
803
484
  s: 'strike',
804
485
  sub: 'subscript',
805
- sup: 'superscript'
806
- })
486
+ sup: 'superscript',
487
+ }),
807
488
  );
808
489
  o.set('_defaultTagCommand', {
809
490
  bold: textTags.bold,
@@ -811,10 +492,10 @@ export function InitOptions(options, editorTargets, plugins) {
811
492
  italic: textTags.italic,
812
493
  strike: textTags.strike,
813
494
  subscript: textTags.sub,
814
- superscript: textTags.sup
495
+ superscript: textTags.sup,
815
496
  });
816
497
  // text direction
817
- o.set('textDirection', typeof options.textDirection !== 'string' ? 'ltr' : options.textDirection);
498
+ o.set('textDirection', options.textDirection ?? 'ltr');
818
499
  o.set('_rtl', o.get('textDirection') === 'rtl');
819
500
  // An array of key codes generated with the reverseButtons option, used to reverse the action for a specific key combination.
820
501
  o.set('reverseCommands', ['indent-outdent'].concat(options.reverseButtons || []));
@@ -825,7 +506,7 @@ export function InitOptions(options, editorTargets, plugins) {
825
506
 
826
507
  // etc
827
508
  o.set('historyStackDelayTime', typeof options.historyStackDelayTime === 'number' ? options.historyStackDelayTime : 400);
828
- o.set('_editableClass', 'sun-editor-editable' + o.get('_themeClass') + (o.get('_rtl') ? ' se-rtl' : '') + (o.get('type') === 'document' ? ' se-type-document-editable' : ''));
509
+ o.set('_editableClass', 'sun-editor-editable' + o.get('_themeClass') + (o.get('_rtl') ? ' se-rtl' : '') + (o.get('type') === 'document' ? ' se-type-document-editable-a4' : ''));
829
510
  o.set('lineAttrReset', ['id'].concat(options.lineAttrReset && typeof options.lineAttrReset === 'string' ? options.lineAttrReset.toLowerCase().split('|') : []));
830
511
  o.set('printClass', typeof options.printClass === 'string' ? options.printClass + ' ' + o.get('_editableClass') : null);
831
512
 
@@ -833,10 +514,10 @@ export function InitOptions(options, editorTargets, plugins) {
833
514
  // default line
834
515
  o.set('defaultLine', typeof options.defaultLine === 'string' && options.defaultLine.length > 0 ? options.defaultLine : 'p');
835
516
  o.set('defaultLineBreakFormat', options.defaultLineBreakFormat || 'line');
836
- o.set('scopeSelectionTags', options.scopeSelectionTags || DEFAULT_SCOPE_SELECTION_TAGS.split('|'));
517
+ o.set('scopeSelectionTags', options.scopeSelectionTags || DEFAULTS.SCOPE_SELECTION_TAGS);
837
518
  // element
838
519
  const elw = (typeof options.elementWhitelist === 'string' ? options.elementWhitelist : '').toLowerCase();
839
- const mjxEls = o.get('externalLibs').mathjax ? DEFAULT_CLASS_MJX + '|' : '';
520
+ const mjxEls = o.get('externalLibs').mathjax ? DEFAULTS.CLASS_MJX + '|' : '';
840
521
  o.set('elementWhitelist', elw + (elw ? '|' : '') + mjxEls + o.get('_allowedExtraTag'));
841
522
  const elb = _createBlacklist((typeof options.elementBlacklist === 'string' ? options.elementBlacklist : '').toLowerCase(), o.get('defaultLine'));
842
523
  o.set('elementBlacklist', elb + (elb ? '|' : '') + o.get('_disallowedExtraTag'));
@@ -848,25 +529,25 @@ export function InitOptions(options, editorTargets, plugins) {
848
529
  'formatClosureBrLine',
849
530
  _createFormatInfo(
850
531
  options.formatClosureBrLine,
851
- (options.__defaultFormatClosureBrLine = typeof options.__defaultFormatClosureBrLine === 'string' ? options.__defaultFormatClosureBrLine : DEFAULT_FORMAT_CLOSURE_BR_LINE).toLowerCase(),
852
- o.get('elementBlacklist')
853
- )
532
+ (options.__defaultFormatClosureBrLine = typeof options.__defaultFormatClosureBrLine === 'string' ? options.__defaultFormatClosureBrLine : DEFAULTS.FORMAT_CLOSURE_BR_LINE).toLowerCase(),
533
+ o.get('elementBlacklist'),
534
+ ),
854
535
  );
855
536
  o.set(
856
537
  'formatBrLine',
857
538
  _createFormatInfo(
858
539
  (options.formatBrLine || '') + '|' + o.get('formatClosureBrLine').str,
859
- (options.__defaultFormatBrLine = typeof options.__defaultFormatBrLine === 'string' ? options.__defaultFormatBrLine : DEFAULT_FORMAT_BR_LINE).toLowerCase(),
860
- o.get('elementBlacklist')
861
- )
540
+ (options.__defaultFormatBrLine = typeof options.__defaultFormatBrLine === 'string' ? options.__defaultFormatBrLine : DEFAULTS.FORMAT_BR_LINE).toLowerCase(),
541
+ o.get('elementBlacklist'),
542
+ ),
862
543
  );
863
544
  o.set(
864
545
  'formatLine',
865
546
  _createFormatInfo(
866
- REQUIRED_FORMAT_LINE + '|' + (options.formatLine || '') + '|' + o.get('formatBrLine').str,
867
- (options.__defaultFormatLine = typeof options.__defaultFormatLine === 'string' ? options.__defaultFormatLine : DEFAULT_FORMAT_LINE).toLowerCase(),
868
- o.get('elementBlacklist')
869
- )
547
+ DEFAULTS.REQUIRED_FORMAT_LINE + '|' + (options.formatLine || '') + '|' + o.get('formatBrLine').str,
548
+ (options.__defaultFormatLine = typeof options.__defaultFormatLine === 'string' ? options.__defaultFormatLine : DEFAULTS.FORMAT_LINE).toLowerCase(),
549
+ o.get('elementBlacklist'),
550
+ ),
870
551
  );
871
552
 
872
553
  // Error - default line
@@ -878,24 +559,24 @@ export function InitOptions(options, editorTargets, plugins) {
878
559
  'formatClosureBlock',
879
560
  _createFormatInfo(
880
561
  options.formatClosureBlock,
881
- (options.__defaultFormatClosureBlock = typeof options.__defaultFormatClosureBlock === 'string' ? options.__defaultFormatClosureBlock : DEFAULT_FORMAT_CLOSURE_BLOCK).toLowerCase(),
882
- o.get('elementBlacklist')
883
- )
562
+ (options.__defaultFormatClosureBlock = typeof options.__defaultFormatClosureBlock === 'string' ? options.__defaultFormatClosureBlock : DEFAULTS.FORMAT_CLOSURE_BLOCK).toLowerCase(),
563
+ o.get('elementBlacklist'),
564
+ ),
884
565
  );
885
566
  o.set(
886
567
  'formatBlock',
887
568
  _createFormatInfo(
888
569
  (options.formatBlock || '') + '|' + o.get('formatClosureBlock').str,
889
- (options.__defaultFormatBlock = typeof options.__defaultFormatBlock === 'string' ? options.__defaultFormatBlock : DEFAULT_FORMAT_BLOCK).toLowerCase(),
890
- o.get('elementBlacklist')
891
- )
570
+ (options.__defaultFormatBlock = typeof options.__defaultFormatBlock === 'string' ? options.__defaultFormatBlock : DEFAULTS.FORMAT_BLOCK).toLowerCase(),
571
+ o.get('elementBlacklist'),
572
+ ),
892
573
  );
893
574
 
894
- o.set('allowedEmptyTags', DEFAULT_ALLOWED_EMPTY_NODE_LIST + (options.allowedEmptyTags ? ', ' + options.allowedEmptyTags : ''));
575
+ o.set('allowedEmptyTags', DEFAULTS.ALLOWED_EMPTY_NODE_LIST + (options.allowedEmptyTags ? ', ' + options.allowedEmptyTags : ''));
895
576
 
896
577
  /** __defaults */
897
- o.set('__defaultElementWhitelist', REQUIRED_ELEMENT_WHITELIST + '|' + (typeof options.__defaultElementWhitelist === 'string' ? options.__defaultElementWhitelist : DEFAULT_ELEMENT_WHITELIST).toLowerCase());
898
- o.set('__defaultAttributeWhitelist', (typeof options.__defaultAttributeWhitelist === 'string' ? options.__defaultAttributeWhitelist : DEFAULT_ATTRIBUTE_WHITELIST).toLowerCase());
578
+ o.set('__defaultElementWhitelist', DEFAULTS.REQUIRED_ELEMENT_WHITELIST + '|' + (typeof options.__defaultElementWhitelist === 'string' ? options.__defaultElementWhitelist : DEFAULTS.ELEMENT_WHITELIST).toLowerCase());
579
+ o.set('__defaultAttributeWhitelist', (typeof options.__defaultAttributeWhitelist === 'string' ? options.__defaultAttributeWhitelist : DEFAULTS.ATTRIBUTE_WHITELIST).toLowerCase());
899
580
  // --- create element whitelist (__defaultElementWhiteList + elementWhitelist + format[line, BrLine, Block, Closureblock, ClosureBrLine] - elementBlacklist)
900
581
  o.set('_editorElementWhitelist', o.get('elementWhitelist') === '*' ? '*' : _createWhitelist(o));
901
582
 
@@ -913,7 +594,7 @@ export function InitOptions(options, editorTargets, plugins) {
913
594
  console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.');
914
595
  } else {
915
596
  o.set('_subMode', subbar.mode || 'balloon');
916
- o.set('toolbar.sub_width', subbar.width ? (numbers.is(subbar.width) ? subbar.width + 'px' : subbar.width) : 'auto');
597
+ o.set('toolbar_sub_width', subbar.width ? (numbers.is(subbar.width) ? subbar.width + 'px' : subbar.width) : 'auto');
917
598
  subButtons = o.get('_rtl') ? subbar.buttonList.reverse() : subbar.buttonList;
918
599
  o.set('buttons_sub', new Set(subButtons.toString().split(',')));
919
600
  }
@@ -922,7 +603,7 @@ export function InitOptions(options, editorTargets, plugins) {
922
603
  /** root options */
923
604
  const frameMap = new Map();
924
605
  for (let i = 0, len = editorTargets.length; i < len; i++) {
925
- frameMap.set(editorTargets[i].key, InitFrameOptions(editorTargets[i].options || {}, options));
606
+ frameMap.set(editorTargets[i].key, InitFrameOptions(editorTargets[i].options || /** @type {SunEditor.InitFrameOptions} */ ({}), options));
926
607
  }
927
608
 
928
609
  /** Key actions */
@@ -949,17 +630,17 @@ export function InitOptions(options, editorTargets, plugins) {
949
630
  list_numbered: ['!+1.+_+~shortcut', ''],
950
631
  list_bulleted: ['!+*.+_+~shortcut', ''],
951
632
  // custom
952
- _h1: ['c+s+Digit1|Numpad1+$~formatBlock.applyHeaderByShortcut', ''],
953
- _h2: ['c+s+Digit2|Numpad2+$~formatBlock.applyHeaderByShortcut', ''],
954
- _h3: ['c+s+Digit3|Numpad3+$~formatBlock.applyHeaderByShortcut', '']
633
+ _h1: ['c+s+Digit1|Numpad1+$~blockStyle.applyHeaderByShortcut', ''],
634
+ _h2: ['c+s+Digit2|Numpad2+$~blockStyle.applyHeaderByShortcut', ''],
635
+ _h3: ['c+s+Digit3|Numpad3+$~blockStyle.applyHeaderByShortcut', ''],
955
636
  },
956
- options.shortcuts || {}
957
- ].reduce((_default, _new) => {
637
+ options.shortcuts || {},
638
+ ].reduce((_default, _new) => {
958
639
  for (const key in _new) {
959
640
  _default[key] = _new[key];
960
641
  }
961
642
  return _default;
962
- }, {});
643
+ }, {});
963
644
  o.set('shortcuts', shortcuts);
964
645
 
965
646
  /** View */
@@ -968,7 +649,7 @@ export function InitOptions(options, editorTargets, plugins) {
968
649
  o.set('printTemplate', typeof options.printTemplate === 'string' ? options.printTemplate : null);
969
650
 
970
651
  /** --- Media select */
971
- o.set('componentAutoSelect', options.componentAutoSelect === undefined ? false : !!options.componentAutoSelect);
652
+ o.set('componentInsertBehavior', ['auto', 'select', 'line', 'none'].includes(options.componentInsertBehavior) ? options.componentInsertBehavior : 'auto');
972
653
 
973
654
  /** --- Url input protocol */
974
655
  o.set('defaultUrlProtocol', typeof options.defaultUrlProtocol === 'string' ? options.defaultUrlProtocol : null);
@@ -983,7 +664,7 @@ export function InitOptions(options, editorTargets, plugins) {
983
664
  } else if (cm.src) {
984
665
  o.set('codeMirror5Editor', true);
985
666
  } else {
986
- console.warn('[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly.');
667
+ console.warn('[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly. See: https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md');
987
668
  o.set('codeMirror', null);
988
669
  }
989
670
  }
@@ -1000,14 +681,14 @@ export function InitOptions(options, editorTargets, plugins) {
1000
681
  _default[key] = _new[key];
1001
682
  }
1002
683
  return _default;
1003
- }, {});
684
+ }, {});
1004
685
  o.set('icons', icons);
1005
686
 
1006
687
  /** Create all used styles */
1007
- const allUsedStyles = new Set(DEFAULT_CONTENT_STYLES.split('|'));
688
+ const allUsedStyles = new Set(DEFAULTS.CONTENT_STYLES.split('|'));
1008
689
  const _ss = options.spanStyles?.split('|') || [];
1009
690
  const _ls = o.get('__listCommonStyle');
1010
- const _dts = DEFAULT_TEXT_STYLES.split('|');
691
+ const _dts = DEFAULTS.SPAN_STYLES.split('|');
1011
692
  for (let i = 0, len = _dts.length; i < len; i++) {
1012
693
  allUsedStyles.add(_dts[i]);
1013
694
  }
@@ -1038,13 +719,13 @@ export function InitOptions(options, editorTargets, plugins) {
1038
719
  buttons: o.get('_rtl') ? buttonList.reverse() : buttonList,
1039
720
  subButtons: subButtons,
1040
721
  statusbarContainer: typeof options.statusbar_container === 'string' ? _d.querySelector(options.statusbar_container) : options.statusbar_container,
1041
- frameMap: frameMap
722
+ frameMap: frameMap,
1042
723
  };
1043
724
  }
1044
725
 
1045
726
  /**
1046
727
  * @description Create a context object for the editor frame.
1047
- * @param {Map<string, *>} targetOptions - editor.frameOptions
728
+ * @param {SunEditor.FrameOptions} targetOptions - `editor.frameOptions`
1048
729
  * @param {HTMLElement} statusbar - statusbar element
1049
730
  * @returns {{statusbar: HTMLElement, navigation: HTMLElement, charWrapper: HTMLElement, charCounter: HTMLElement}}
1050
731
  */
@@ -1054,7 +735,7 @@ export function CreateStatusbar(targetOptions, statusbar) {
1054
735
  let charCounter = null;
1055
736
 
1056
737
  if (targetOptions.get('statusbar')) {
1057
- statusbar = statusbar || dom.utils.createElement('DIV', { class: 'se-status-bar sun-editor-common' });
738
+ statusbar ||= dom.utils.createElement('DIV', { class: 'se-status-bar sun-editor-common' });
1058
739
 
1059
740
  /** navigation */
1060
741
  navigation = statusbar.querySelector('.se-navigation') || dom.utils.createElement('DIV', { class: 'se-navigation sun-editor-common' });
@@ -1088,18 +769,18 @@ export function CreateStatusbar(targetOptions, statusbar) {
1088
769
  statusbar: statusbar,
1089
770
  navigation: /** @type {HTMLElement} */ (navigation),
1090
771
  charWrapper: /** @type {HTMLElement} */ (charWrapper),
1091
- charCounter: /** @type {HTMLElement} */ (charCounter)
772
+ charCounter: /** @type {HTMLElement} */ (charCounter),
1092
773
  };
1093
774
  }
1094
775
 
1095
776
  /**
1096
777
  * @description Initialize options.
1097
- * @param {EditorFrameOptions} o - Target options
1098
- * @param {EditorInitOptions} origin - Full options
1099
- * @returns {Map<string, *>}
778
+ * @param {SunEditor.InitFrameOptions} o - Target options
779
+ * @param {SunEditor.InitOptions} origin - Full options
780
+ * @returns {SunEditor.FrameOptions} Processed frame options `Map`
1100
781
  */
1101
782
  function InitFrameOptions(o, origin) {
1102
- const fo = new Map();
783
+ const fo = /** @type {SunEditor.FrameOptions} */ (/** @type {unknown} */ (new Map()));
1103
784
 
1104
785
  fo.set('_origin', o);
1105
786
  const barContainer = origin.statusbar_container;
@@ -1130,21 +811,21 @@ function InitFrameOptions(o, origin) {
1130
811
  // value
1131
812
  fo.set('value', value);
1132
813
  fo.set('placeholder', placeholder);
1133
- fo.set('editableFrameAttributes', editableFrameAttributes || {});
814
+ fo.set('editableFrameAttributes', { spellcheck: 'false', ...editableFrameAttributes });
1134
815
  // styles
1135
- fo.set('width', width ? (numbers.is(width) ? width + 'px' : width) : '100%');
1136
- fo.set('minWidth', (numbers.is(minWidth) ? minWidth + 'px' : minWidth) || '');
1137
- fo.set('maxWidth', (numbers.is(maxWidth) ? maxWidth + 'px' : maxWidth) || '');
1138
- fo.set('height', height ? (numbers.is(height) ? height + 'px' : height) : 'auto');
1139
- fo.set('minHeight', (numbers.is(minHeight) ? minHeight + 'px' : minHeight) || '');
1140
- fo.set('maxHeight', (numbers.is(maxHeight) ? maxHeight + 'px' : maxHeight) || '');
816
+ fo.set('width', width ? String(numbers.is(width) ? width + 'px' : width) : '100%');
817
+ fo.set('minWidth', minWidth ? String(numbers.is(minWidth) ? minWidth + 'px' : minWidth) : '');
818
+ fo.set('maxWidth', maxWidth ? String(numbers.is(maxWidth) ? maxWidth + 'px' : maxWidth) : '');
819
+ fo.set('height', height ? String(numbers.is(height) ? height + 'px' : height) : 'auto');
820
+ fo.set('minHeight', minHeight ? String(numbers.is(minHeight) ? minHeight + 'px' : minHeight) : '');
821
+ fo.set('maxHeight', maxHeight ? String(numbers.is(maxHeight) ? maxHeight + 'px' : maxHeight) : '');
1141
822
  fo.set('editorStyle', editorStyle);
1142
823
  fo.set('_defaultStyles', converter._setDefaultOptionStyle(fo, typeof editorStyle === 'string' ? editorStyle : ''));
1143
824
  // iframe
1144
825
  fo.set('iframe', !!(iframe_fullPage || iframe));
1145
826
  fo.set('iframe_fullPage', !!iframe_fullPage);
1146
827
  fo.set('iframe_attributes', iframe_attributes || {});
1147
- fo.set('iframe_cssFileName', iframe ? (typeof iframe_cssFileName === 'string' ? [iframe_cssFileName] : iframe_cssFileName || ['suneditor']) : null);
828
+ fo.set('iframe_cssFileName', iframe ? (typeof iframe_cssFileName === 'string' ? [iframe_cssFileName] : iframe_cssFileName) || ['suneditor'] : null);
1148
829
  // status bar
1149
830
  const hasStatusbar = statusbar === undefined ? true : !!statusbar;
1150
831
  fo.set('statusbar', hasStatusbar);
@@ -1160,12 +841,11 @@ function InitFrameOptions(o, origin) {
1160
841
  }
1161
842
 
1162
843
  /**
1163
- * @private
1164
- * @description Initialize property of suneditor elements
844
+ * @description Initialize property of `suneditor` elements
1165
845
  * @param {string} key - The key of the editor frame
1166
- * @param {Map<string, *>} options - options
1167
- * @param {HTMLElement} topDiv - top div
1168
- * @param {Map<string, *>} targetOptions - editor.frameOptions
846
+ * @param {Map<string, *>} options - Options
847
+ * @param {HTMLElement} topDiv - Top div
848
+ * @param {SunEditor.FrameOptions} targetOptions - `editor.frameOptions`
1169
849
  * @returns {{bottomBar: ReturnType<CreateStatusbar>, wysiwygFrame: HTMLElement, codeView: HTMLElement, placeholder: HTMLElement}}
1170
850
  */
1171
851
  function _initTargetElements(key, options, topDiv, targetOptions) {
@@ -1176,24 +856,47 @@ function _initTargetElements(key, options, topDiv, targetOptions) {
1176
856
  /** editor */
1177
857
  // wysiwyg div or iframe
1178
858
  const wysiwygDiv = dom.utils.createElement(!targetOptions.get('iframe') ? 'DIV' : 'IFRAME', {
1179
- class: 'se-wrapper-inner se-wrapper-wysiwyg',
1180
- 'data-root-key': key
859
+ class: 'se-wrapper-inner se-wrapper-wysiwyg' + (options.get('type') === 'document' ? ' se-type-document-iframe-a4' : ''),
860
+ 'data-root-key': key,
1181
861
  });
1182
862
 
1183
863
  if (!targetOptions.get('iframe')) {
1184
864
  wysiwygDiv.setAttribute('contenteditable', 'true');
1185
- wysiwygDiv.setAttribute('scrolling', 'auto');
1186
865
  wysiwygDiv.className += ' ' + options.get('_editableClass');
1187
866
  wysiwygDiv.style.cssText = editorStyles.frame + editorStyles.editor;
1188
867
  } else {
868
+ const iframeWW = /** @type {HTMLIFrameElement} */ (wysiwygDiv);
1189
869
  const frameAttrs = targetOptions.get('iframe_attributes');
870
+
871
+ // [sandbox] prop
872
+ let sandboxValue = frameAttrs.sandbox;
873
+ if (sandboxValue) {
874
+ const requiredSandbox = ['allow-same-origin'];
875
+ const userSandbox = sandboxValue.split(/\s+/);
876
+ const missingSandbox = requiredSandbox.filter((req) => !userSandbox.includes(req));
877
+
878
+ if (missingSandbox.length > 0) {
879
+ // Add missing required value
880
+ sandboxValue = userSandbox.concat(missingSandbox).join(' ');
881
+ }
882
+ } else {
883
+ sandboxValue = 'allow-same-origin';
884
+ }
885
+
886
+ // iframe [sandbox] attr
887
+ iframeWW.setAttribute('sandbox', sandboxValue);
888
+
889
+ // iframe [default border]
890
+ iframeWW.setAttribute('frameBorder', '0');
891
+
892
+ // iframe attr
1190
893
  for (const frameKey in frameAttrs) {
1191
- wysiwygDiv.setAttribute(frameKey, frameAttrs[frameKey]);
894
+ if (frameKey === 'sandbox') continue;
895
+ iframeWW.setAttribute(frameKey, frameAttrs[frameKey]);
1192
896
  }
1193
897
 
1194
- const iframeWW = /** @type {HTMLIFrameElement} */ (wysiwygDiv);
1195
898
  iframeWW.allowFullscreen = true;
1196
- iframeWW.frameBorder = '0';
899
+ iframeWW.setAttribute('scrolling', targetOptions.get('height') === 'auto' ? 'no' : 'auto');
1197
900
  iframeWW.style.cssText = editorStyles.frame;
1198
901
  }
1199
902
 
@@ -1208,15 +911,14 @@ function _initTargetElements(key, options, topDiv, targetOptions) {
1208
911
  bottomBar: CreateStatusbar(targetOptions, null),
1209
912
  wysiwygFrame: wysiwygDiv,
1210
913
  codeView: textarea,
1211
- placeholder: placeholder
914
+ placeholder: placeholder,
1212
915
  };
1213
916
  }
1214
917
 
1215
918
  /**
1216
- * @private
1217
- * @description Check the CodeMirror option to apply the CodeMirror and return the CodeMirror element.
1218
- * @param {Map<string, *>} options options
1219
- * @param {HTMLElement} textarea textarea element
919
+ * @description Check the `CodeMirror` option to apply the `CodeMirror` and return the `CodeMirror` element.
920
+ * @param {Map<string, *>} options Options
921
+ * @param {HTMLElement} textarea Textarea element
1220
922
  */
1221
923
  function _checkCodeMirror(options, targetOptions, textarea) {
1222
924
  let cmeditor = null;
@@ -1228,7 +930,7 @@ function _checkCodeMirror(options, targetOptions, textarea) {
1228
930
  const cm = new codeMirror.EditorView({
1229
931
  parent: textarea.parentElement,
1230
932
  extensions: codeMirror.extensions,
1231
- state: codeMirror.state
933
+ state: codeMirror.state,
1232
934
  });
1233
935
 
1234
936
  targetOptions.set('codeMirror6Editor', cm);
@@ -1242,9 +944,9 @@ function _checkCodeMirror(options, targetOptions, textarea) {
1242
944
  mode: 'htmlmixed',
1243
945
  htmlMode: true,
1244
946
  lineNumbers: true,
1245
- lineWrapping: true
947
+ lineWrapping: true,
1246
948
  },
1247
- codeMirror.options || {}
949
+ codeMirror.options || {},
1248
950
  ].reduce((init, option) => {
1249
951
  for (const key in option) {
1250
952
  init[key] = option[key];
@@ -1276,10 +978,9 @@ function _checkCodeMirror(options, targetOptions, textarea) {
1276
978
  }
1277
979
 
1278
980
  /**
1279
- * @private
1280
- * @description create blacklist
1281
- * @param {string} blacklist blacklist
1282
- * @param {string} defaultLine options.get('defaultLine')
981
+ * @description Create blacklist
982
+ * @param {string} blacklist Blacklist
983
+ * @param {string} defaultLine `options.get('defaultLine')`
1283
984
  * @returns {string}
1284
985
  */
1285
986
  function _createBlacklist(blacklist, defaultLine) {
@@ -1298,8 +999,7 @@ function _createBlacklist(blacklist, defaultLine) {
1298
999
  }
1299
1000
 
1300
1001
  /**
1301
- * @private
1302
- * @description create formats regexp object.
1002
+ * @description Create formats regexp object.
1303
1003
  * @param {string} value value
1304
1004
  * @param {string} defaultValue default value
1305
1005
  * @param {string} blacklist blacklist
@@ -1314,13 +1014,12 @@ function _createFormatInfo(value, defaultValue, blacklist) {
1314
1014
  .join('|');
1315
1015
  return {
1316
1016
  reg: new RegExp(`^(${str})$`, 'i'),
1317
- str: str
1017
+ str: str,
1318
1018
  };
1319
1019
  }
1320
1020
 
1321
1021
  /**
1322
- * @private
1323
- * @description create whitelist or blacklist.
1022
+ * @description Create whitelist or blacklist.
1324
1023
  * @param {Map<string, *>} o options
1325
1024
  * @returns {string} whitelist
1326
1025
  */
@@ -1335,12 +1034,10 @@ function _createWhitelist(o) {
1335
1034
  }
1336
1035
 
1337
1036
  /**
1338
- * @private
1339
- * @description Suneditor's Default button list
1340
- * @param {Map<string, *>} options options
1037
+ * @description SunEditor's default button list
1038
+ * @param {boolean} isRTL `rtl`
1341
1039
  */
1342
- function _defaultButtons(options, icons, lang) {
1343
- const isRTL = options.get('_rtl');
1040
+ function _defaultButtons(isRTL, icons, lang) {
1344
1041
  return {
1345
1042
  bold: ['', lang.bold, 'bold', '', icons.bold],
1346
1043
  underline: ['', lang.underline, 'underline', '', icons.underline],
@@ -1370,12 +1067,11 @@ function _defaultButtons(options, icons, lang) {
1370
1067
  // document type buttons
1371
1068
  pageUp: ['se-component-enabled', lang.pageUp, 'pageUp', '', icons.page_up],
1372
1069
  pageDown: ['se-component-enabled', lang.pageDown, 'pageDown', '', icons.page_down],
1373
- pageNavigator: ['se-component-enabled', '', 'pageNavigator', 'input', '']
1070
+ pageNavigator: ['se-component-enabled', '', 'pageNavigator', 'input', ''],
1374
1071
  };
1375
1072
  }
1376
1073
 
1377
1074
  /**
1378
- * @private
1379
1075
  * @description Create a group div containing each module
1380
1076
  * @returns {{div: Element, ul: Element}}
1381
1077
  */
@@ -1385,24 +1081,23 @@ function _createModuleGroup() {
1385
1081
 
1386
1082
  return {
1387
1083
  div: oDiv,
1388
- ul: oUl
1084
+ ul: oUl,
1389
1085
  };
1390
1086
  }
1391
1087
 
1392
1088
  /**
1393
- * @private
1394
1089
  * @description Create a button element
1395
- * @param {string} className className in button
1090
+ * @param {string} className `className` in button
1396
1091
  * @param {string} title Title in button
1397
- * @param {string} dataCommand The data-command property of the button
1398
- * @param {"command"|"dropdown"|"field"|"browser"|"input"|"modal"|"popup"} dataType The data-type property of the button
1399
- * @param {string} innerHTML Html in button
1400
- * @param {string} _disabled Button disabled
1092
+ * @param {string} dataCommand The `data-command` property of the button
1093
+ * @param {"command"|"dropdown"|"field"|"browser"|"input"|"modal"|"popup"} dataType The `data-type` property of the button
1094
+ * @param {string} innerHTML HTML in button
1095
+ * @param {string} _disabled Button `disabled`
1401
1096
  * @param {Object<string, string>} icons Icons
1402
1097
  * @returns {{li: HTMLElement, button: HTMLElement}}
1403
1098
  */
1404
1099
  function _createButton(className, title, dataCommand, dataType, innerHTML, _disabled, icons) {
1405
- if (!innerHTML) innerHTML = '';
1100
+ innerHTML ||= '';
1406
1101
 
1407
1102
  const oLi = dom.utils.createElement('LI');
1408
1103
  const label = title || '';
@@ -1415,8 +1110,8 @@ function _createButton(className, title, dataCommand, dataType, innerHTML, _disa
1415
1110
  'data-command': dataCommand,
1416
1111
  'data-type': dataType,
1417
1112
  'aria-label': label.replace(/<span .+<\/span>/, ''),
1418
- tabindex: '-1'
1419
- })
1113
+ tabindex: '-1',
1114
+ })
1420
1115
  );
1421
1116
 
1422
1117
  if (!isDiv) {
@@ -1442,13 +1137,13 @@ function _createButton(className, title, dataCommand, dataType, innerHTML, _disa
1442
1137
 
1443
1138
  return {
1444
1139
  li: oLi,
1445
- button: oButton
1140
+ button: oButton,
1446
1141
  };
1447
1142
  }
1448
1143
 
1449
1144
  /**
1450
1145
  * @description Update a button state, attributes, and icons
1451
- * @param {HTMLElement|null} element Button element
1146
+ * @param {?HTMLElement} element Button element
1452
1147
  * @param {Object<string, *>} plugin Plugin
1453
1148
  * @param {Object<string, string>} icons Icons
1454
1149
  * @param {Object<string, string>} lang lang
@@ -1514,18 +1209,18 @@ export function UpdateButton(element, plugin, icons, lang) {
1514
1209
 
1515
1210
  /**
1516
1211
  * @description Create editor HTML
1517
- * @param {Array} buttonList option.buttonList
1212
+ * @param {Array} buttonList `option.buttonList`
1518
1213
  * @param {?Object<string, *>} plugins Plugins
1519
- * @param {Map<string, *>} options options
1520
- * @param {Object<string, string>} icons icons
1521
- * @param {Object<string, string>} lang lang
1214
+ * @param {Map<string, *>|SunEditor.Options} options Options
1215
+ * @param {Object<string, string>} icons Icons
1216
+ * @param {Object<string, string>} lang Lang
1522
1217
  * @param {boolean} isUpdate Is update
1523
1218
  * @returns {{element: HTMLElement, pluginCallButtons: Object<string, Array<HTMLElement>>, responsiveButtons: Array<HTMLElement>, buttonTray: HTMLElement, updateButtons: Array<{button: HTMLElement, plugin: *, key: string}>}}}
1524
1219
  */
1525
1220
  export function CreateToolBar(buttonList, plugins, options, icons, lang, isUpdate) {
1526
1221
  /** create button list */
1527
1222
  buttonList = JSON.parse(JSON.stringify(buttonList));
1528
- const defaultButtonList = _defaultButtons(options, icons, lang);
1223
+ const defaultButtonList = _defaultButtons(options.get('_rtl'), icons, lang);
1529
1224
  /** @type {Object<string, Array<HTMLElement>>} */
1530
1225
  const pluginCallButtons = {};
1531
1226
  const responsiveButtons = [];
@@ -1596,7 +1291,6 @@ export function CreateToolBar(buttonList, plugins, options, icons, lang, isUpdat
1596
1291
  // default command
1597
1292
  if (button === 'copy' && !env.isClipboardSupported) {
1598
1293
  console.warn('[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered.');
1599
- continue;
1600
1294
  }
1601
1295
  modules = defaultButtonList[button];
1602
1296
  }
@@ -1677,7 +1371,7 @@ export function CreateToolBar(buttonList, plugins, options, icons, lang, isUpdat
1677
1371
  pluginCallButtons,
1678
1372
  responsiveButtons,
1679
1373
  buttonTray,
1680
- updateButtons
1374
+ updateButtons,
1681
1375
  };
1682
1376
  }
1683
1377