suneditor 3.0.0-alpha.2 → 3.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/.eslintrc.json +4 -3
  2. package/CONTRIBUTING.md +4 -2
  3. package/README.md +19 -11
  4. package/README_V3_TEMP.md +705 -0
  5. package/dist/suneditor.min.css +1 -0
  6. package/dist/suneditor.min.js +1 -0
  7. package/example.md +587 -0
  8. package/package.json +15 -9
  9. package/src/assets/icons/_default.js +166 -131
  10. package/src/assets/{suneditor-content.css → suneditor-contents.css} +182 -45
  11. package/src/assets/suneditor.css +1195 -556
  12. package/src/assets/variables.css +138 -0
  13. package/src/core/base/eventHandlers/handler_toolbar.js +35 -14
  14. package/src/core/base/eventHandlers/handler_ww_clipboard.js +29 -4
  15. package/src/core/base/eventHandlers/handler_ww_dragDrop.js +59 -15
  16. package/src/core/base/eventHandlers/handler_ww_key_input.js +426 -212
  17. package/src/core/base/eventHandlers/handler_ww_mouse.js +108 -32
  18. package/src/core/base/eventManager.js +540 -209
  19. package/src/core/base/events.js +616 -320
  20. package/src/core/base/history.js +93 -39
  21. package/src/core/class/char.js +29 -13
  22. package/src/core/class/component.js +332 -145
  23. package/src/core/class/format.js +671 -509
  24. package/src/core/class/html.js +504 -290
  25. package/src/core/class/menu.js +114 -47
  26. package/src/core/class/nodeTransform.js +111 -66
  27. package/src/core/class/offset.js +409 -105
  28. package/src/core/class/selection.js +220 -108
  29. package/src/core/class/shortcuts.js +68 -8
  30. package/src/core/class/toolbar.js +106 -116
  31. package/src/core/class/ui.js +330 -0
  32. package/src/core/class/viewer.js +178 -74
  33. package/src/core/editor.js +489 -384
  34. package/src/core/section/actives.js +118 -22
  35. package/src/core/section/constructor.js +504 -170
  36. package/src/core/section/context.js +28 -23
  37. package/src/core/section/documentType.js +561 -0
  38. package/src/editorInjector/_classes.js +19 -5
  39. package/src/editorInjector/_core.js +71 -7
  40. package/src/editorInjector/index.js +63 -1
  41. package/src/helper/converter.js +137 -19
  42. package/src/helper/dom/domCheck.js +294 -0
  43. package/src/helper/dom/domQuery.js +609 -0
  44. package/src/helper/dom/domUtils.js +533 -0
  45. package/src/helper/dom/index.js +12 -0
  46. package/src/helper/env.js +42 -19
  47. package/src/helper/index.js +7 -4
  48. package/src/helper/keyCodeMap.js +183 -0
  49. package/src/helper/numbers.js +8 -8
  50. package/src/helper/unicode.js +5 -5
  51. package/src/langs/ckb.js +69 -3
  52. package/src/langs/cs.js +67 -1
  53. package/src/langs/da.js +68 -2
  54. package/src/langs/de.js +68 -3
  55. package/src/langs/en.js +29 -1
  56. package/src/langs/es.js +68 -3
  57. package/src/langs/fa.js +70 -2
  58. package/src/langs/fr.js +68 -2
  59. package/src/langs/he.js +68 -3
  60. package/src/langs/hu.js +226 -0
  61. package/src/langs/index.js +3 -2
  62. package/src/langs/it.js +65 -0
  63. package/src/langs/ja.js +68 -3
  64. package/src/langs/ko.js +66 -1
  65. package/src/langs/lv.js +68 -3
  66. package/src/langs/nl.js +68 -3
  67. package/src/langs/pl.js +68 -3
  68. package/src/langs/pt_br.js +65 -0
  69. package/src/langs/ro.js +69 -4
  70. package/src/langs/ru.js +68 -3
  71. package/src/langs/se.js +68 -3
  72. package/src/langs/tr.js +68 -0
  73. package/src/langs/ua.js +68 -3
  74. package/src/langs/ur.js +71 -6
  75. package/src/langs/zh_cn.js +69 -4
  76. package/src/modules/ApiManager.js +77 -54
  77. package/src/modules/Browser.js +667 -0
  78. package/src/modules/ColorPicker.js +162 -102
  79. package/src/modules/Controller.js +233 -136
  80. package/src/modules/Figure.js +913 -489
  81. package/src/modules/FileManager.js +141 -72
  82. package/src/modules/HueSlider.js +113 -61
  83. package/src/modules/Modal.js +292 -113
  84. package/src/modules/ModalAnchorEditor.js +380 -230
  85. package/src/modules/SelectMenu.js +270 -168
  86. package/src/modules/_DragHandle.js +2 -1
  87. package/src/modules/index.js +3 -3
  88. package/src/plugins/browser/audioGallery.js +83 -0
  89. package/src/plugins/browser/fileBrowser.js +103 -0
  90. package/src/plugins/browser/fileGallery.js +83 -0
  91. package/src/plugins/browser/imageGallery.js +81 -0
  92. package/src/plugins/browser/videoGallery.js +103 -0
  93. package/src/plugins/command/blockquote.js +40 -27
  94. package/src/plugins/command/exportPDF.js +134 -0
  95. package/src/plugins/command/fileUpload.js +226 -158
  96. package/src/plugins/command/list_bulleted.js +93 -47
  97. package/src/plugins/command/list_numbered.js +93 -47
  98. package/src/plugins/dropdown/align.js +66 -54
  99. package/src/plugins/dropdown/backgroundColor.js +76 -45
  100. package/src/plugins/dropdown/font.js +71 -47
  101. package/src/plugins/dropdown/fontColor.js +78 -46
  102. package/src/plugins/dropdown/formatBlock.js +74 -33
  103. package/src/plugins/dropdown/hr.js +102 -51
  104. package/src/plugins/dropdown/layout.js +37 -26
  105. package/src/plugins/dropdown/lineHeight.js +54 -38
  106. package/src/plugins/dropdown/list.js +60 -45
  107. package/src/plugins/dropdown/paragraphStyle.js +51 -30
  108. package/src/plugins/dropdown/table.js +1269 -777
  109. package/src/plugins/dropdown/template.js +38 -26
  110. package/src/plugins/dropdown/textStyle.js +43 -31
  111. package/src/plugins/field/mention.js +144 -82
  112. package/src/plugins/index.js +32 -6
  113. package/src/plugins/input/fontSize.js +161 -108
  114. package/src/plugins/input/pageNavigator.js +70 -0
  115. package/src/plugins/modal/audio.js +341 -169
  116. package/src/plugins/modal/drawing.js +530 -0
  117. package/src/plugins/modal/embed.js +886 -0
  118. package/src/plugins/modal/image.js +673 -358
  119. package/src/plugins/modal/link.js +100 -71
  120. package/src/plugins/modal/math.js +384 -168
  121. package/src/plugins/modal/video.js +693 -336
  122. package/src/plugins/popup/anchor.js +222 -0
  123. package/src/suneditor.js +54 -12
  124. package/src/themes/dark.css +85 -0
  125. package/src/typedef.js +86 -0
  126. package/types/assets/icons/_default.d.ts +152 -0
  127. package/types/core/base/eventHandlers/handler_toolbar.d.ts +41 -0
  128. package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +40 -0
  129. package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +35 -0
  130. package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +45 -0
  131. package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +39 -0
  132. package/types/core/base/eventManager.d.ts +377 -0
  133. package/types/core/base/events.d.ts +297 -0
  134. package/types/core/base/history.d.ts +81 -0
  135. package/types/core/class/char.d.ts +60 -0
  136. package/types/core/class/component.d.ts +259 -0
  137. package/types/core/class/format.d.ts +615 -0
  138. package/types/core/class/html.d.ts +377 -0
  139. package/types/core/class/menu.d.ts +118 -0
  140. package/types/core/class/nodeTransform.d.ts +93 -0
  141. package/types/core/class/offset.d.ts +512 -0
  142. package/types/core/class/selection.d.ts +188 -0
  143. package/types/core/class/shortcuts.d.ts +142 -0
  144. package/types/core/class/toolbar.d.ts +189 -0
  145. package/types/core/class/ui.d.ts +144 -0
  146. package/types/core/class/viewer.d.ts +140 -0
  147. package/types/core/editor.d.ts +606 -0
  148. package/types/core/section/actives.d.ts +46 -0
  149. package/types/core/section/constructor.d.ts +748 -0
  150. package/types/core/section/context.d.ts +45 -0
  151. package/types/core/section/documentType.d.ts +178 -0
  152. package/types/editorInjector/_classes.d.ts +41 -0
  153. package/types/editorInjector/_core.d.ts +92 -0
  154. package/types/editorInjector/index.d.ts +71 -0
  155. package/types/helper/converter.d.ts +150 -0
  156. package/types/helper/dom/domCheck.d.ts +182 -0
  157. package/types/helper/dom/domQuery.d.ts +214 -0
  158. package/types/helper/dom/domUtils.d.ts +211 -0
  159. package/types/helper/dom/index.d.ts +9 -0
  160. package/types/helper/env.d.ts +149 -0
  161. package/types/helper/index.d.ts +163 -0
  162. package/types/helper/keyCodeMap.d.ts +110 -0
  163. package/types/helper/numbers.d.ts +43 -0
  164. package/types/helper/unicode.d.ts +28 -0
  165. package/types/index.d.ts +0 -0
  166. package/{typings/Lang.d.ts → types/langs/_Lang.d.ts} +170 -103
  167. package/types/langs/ckb.d.ts +384 -0
  168. package/types/langs/cs.d.ts +384 -0
  169. package/types/langs/da.d.ts +384 -0
  170. package/types/langs/de.d.ts +384 -0
  171. package/types/langs/en.d.ts +384 -0
  172. package/types/langs/es.d.ts +384 -0
  173. package/types/langs/fa.d.ts +384 -0
  174. package/types/langs/fr.d.ts +384 -0
  175. package/types/langs/he.d.ts +384 -0
  176. package/types/langs/hu.d.ts +384 -0
  177. package/types/langs/index.d.ts +48 -0
  178. package/types/langs/it.d.ts +384 -0
  179. package/types/langs/ja.d.ts +384 -0
  180. package/types/langs/ko.d.ts +384 -0
  181. package/types/langs/lv.d.ts +384 -0
  182. package/types/langs/nl.d.ts +384 -0
  183. package/types/langs/pl.d.ts +384 -0
  184. package/types/langs/pt_br.d.ts +384 -0
  185. package/types/langs/ro.d.ts +384 -0
  186. package/types/langs/ru.d.ts +384 -0
  187. package/types/langs/se.d.ts +384 -0
  188. package/types/langs/tr.d.ts +384 -0
  189. package/types/langs/ua.d.ts +384 -0
  190. package/types/langs/ur.d.ts +384 -0
  191. package/types/langs/zh_cn.d.ts +384 -0
  192. package/types/modules/ApiManager.d.ts +125 -0
  193. package/types/modules/Browser.d.ts +326 -0
  194. package/types/modules/ColorPicker.d.ts +131 -0
  195. package/types/modules/Controller.d.ts +231 -0
  196. package/types/modules/Figure.d.ts +504 -0
  197. package/types/modules/FileManager.d.ts +202 -0
  198. package/types/modules/HueSlider.d.ts +136 -0
  199. package/types/modules/Modal.d.ts +117 -0
  200. package/types/modules/ModalAnchorEditor.d.ts +236 -0
  201. package/types/modules/SelectMenu.d.ts +194 -0
  202. package/types/modules/_DragHandle.d.ts +7 -0
  203. package/types/modules/index.d.ts +26 -0
  204. package/types/plugins/browser/audioGallery.d.ts +55 -0
  205. package/types/plugins/browser/fileBrowser.d.ts +64 -0
  206. package/types/plugins/browser/fileGallery.d.ts +55 -0
  207. package/types/plugins/browser/imageGallery.d.ts +51 -0
  208. package/types/plugins/browser/videoGallery.d.ts +57 -0
  209. package/types/plugins/command/blockquote.d.ts +28 -0
  210. package/types/plugins/command/exportPDF.d.ts +46 -0
  211. package/types/plugins/command/fileUpload.d.ts +156 -0
  212. package/types/plugins/command/list_bulleted.d.ts +56 -0
  213. package/types/plugins/command/list_numbered.d.ts +56 -0
  214. package/types/plugins/dropdown/align.d.ts +60 -0
  215. package/types/plugins/dropdown/backgroundColor.d.ts +63 -0
  216. package/types/plugins/dropdown/font.d.ts +54 -0
  217. package/types/plugins/dropdown/fontColor.d.ts +63 -0
  218. package/types/plugins/dropdown/formatBlock.d.ts +58 -0
  219. package/types/plugins/dropdown/hr.d.ts +81 -0
  220. package/types/plugins/dropdown/layout.d.ts +40 -0
  221. package/types/plugins/dropdown/lineHeight.d.ts +50 -0
  222. package/types/plugins/dropdown/list.d.ts +39 -0
  223. package/types/plugins/dropdown/paragraphStyle.d.ts +54 -0
  224. package/types/plugins/dropdown/table.d.ts +579 -0
  225. package/types/plugins/dropdown/template.d.ts +40 -0
  226. package/types/plugins/dropdown/textStyle.d.ts +41 -0
  227. package/types/plugins/field/mention.d.ts +102 -0
  228. package/types/plugins/index.d.ts +107 -0
  229. package/types/plugins/input/fontSize.d.ts +170 -0
  230. package/types/plugins/input/pageNavigator.d.ts +28 -0
  231. package/types/plugins/modal/audio.d.ts +269 -0
  232. package/types/plugins/modal/drawing.d.ts +246 -0
  233. package/types/plugins/modal/embed.d.ts +387 -0
  234. package/types/plugins/modal/image.d.ts +451 -0
  235. package/types/plugins/modal/link.d.ts +128 -0
  236. package/types/plugins/modal/math.d.ts +193 -0
  237. package/types/plugins/modal/video.d.ts +485 -0
  238. package/types/plugins/popup/anchor.d.ts +56 -0
  239. package/types/suneditor.d.ts +51 -0
  240. package/types/typedef-global.d.ts +144 -0
  241. package/src/core/class/notice.js +0 -42
  242. package/src/helper/domUtils.js +0 -1177
  243. package/src/modules/FileBrowser.js +0 -271
  244. package/src/plugins/command/exportPdf.js +0 -168
  245. package/src/plugins/fileBrowser/imageGallery.js +0 -81
  246. package/src/themes/test.css +0 -61
  247. package/typings/CommandPlugin.d.ts +0 -8
  248. package/typings/DialogPlugin.d.ts +0 -20
  249. package/typings/FileBrowserPlugin.d.ts +0 -30
  250. package/typings/Module.d.ts +0 -15
  251. package/typings/Plugin.d.ts +0 -42
  252. package/typings/SubmenuPlugin.d.ts +0 -8
  253. package/typings/_classes.d.ts +0 -17
  254. package/typings/_colorPicker.d.ts +0 -60
  255. package/typings/_core.d.ts +0 -55
  256. package/typings/align.d.ts +0 -5
  257. package/typings/audio.d.ts +0 -5
  258. package/typings/backgroundColor.d.ts +0 -5
  259. package/typings/blockquote.d.ts +0 -5
  260. package/typings/char.d.ts +0 -39
  261. package/typings/component.d.ts +0 -38
  262. package/typings/context.d.ts +0 -39
  263. package/typings/converter.d.ts +0 -33
  264. package/typings/dialog.d.ts +0 -28
  265. package/typings/domUtils.d.ts +0 -361
  266. package/typings/editor.d.ts +0 -7
  267. package/typings/editor.ts +0 -542
  268. package/typings/env.d.ts +0 -70
  269. package/typings/eventManager.d.ts +0 -37
  270. package/typings/events.d.ts +0 -262
  271. package/typings/fileBrowser.d.ts +0 -42
  272. package/typings/fileManager.d.ts +0 -67
  273. package/typings/font.d.ts +0 -5
  274. package/typings/fontColor.d.ts +0 -5
  275. package/typings/fontSize.d.ts +0 -5
  276. package/typings/format.d.ts +0 -191
  277. package/typings/formatBlock.d.ts +0 -5
  278. package/typings/history.d.ts +0 -48
  279. package/typings/horizontalRule.d.ts +0 -5
  280. package/typings/image.d.ts +0 -5
  281. package/typings/imageGallery.d.ts +0 -5
  282. package/typings/index.d.ts +0 -21
  283. package/typings/index.modules.d.ts +0 -11
  284. package/typings/index.plugins.d.ts +0 -58
  285. package/typings/lineHeight.d.ts +0 -5
  286. package/typings/link.d.ts +0 -5
  287. package/typings/list.d.ts +0 -5
  288. package/typings/math.d.ts +0 -5
  289. package/typings/mediaContainer.d.ts +0 -25
  290. package/typings/mention.d.ts +0 -5
  291. package/typings/node.d.ts +0 -57
  292. package/typings/notice.d.ts +0 -16
  293. package/typings/numbers.d.ts +0 -29
  294. package/typings/offset.d.ts +0 -24
  295. package/typings/options.d.ts +0 -589
  296. package/typings/paragraphStyle.d.ts +0 -5
  297. package/typings/resizing.d.ts +0 -141
  298. package/typings/selection.d.ts +0 -94
  299. package/typings/shortcuts.d.ts +0 -13
  300. package/typings/suneditor.d.ts +0 -9
  301. package/typings/table.d.ts +0 -5
  302. package/typings/template.d.ts +0 -5
  303. package/typings/textStyle.d.ts +0 -5
  304. package/typings/toolbar.d.ts +0 -32
  305. package/typings/unicode.d.ts +0 -25
  306. package/typings/video.d.ts +0 -5
@@ -0,0 +1,377 @@
1
+ export default HTML;
2
+ export type HTMLThis = Omit<HTML & Partial<__se__EditorInjector>, 'html'>;
3
+ /**
4
+ * @typedef {Omit<HTML & Partial<__se__EditorInjector>, 'html'>} HTMLThis
5
+ */
6
+ /**
7
+ * @constructor
8
+ * @this {HTMLThis}
9
+ * @description All HTML related classes involved in the editing area
10
+ * @param {__se__EditorCore} editor - The root editor instance
11
+ */
12
+ declare function HTML(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, editor: __se__EditorCore): void;
13
+ declare class HTML {
14
+ /**
15
+ * @typedef {Omit<HTML & Partial<__se__EditorInjector>, 'html'>} HTMLThis
16
+ */
17
+ /**
18
+ * @constructor
19
+ * @this {HTMLThis}
20
+ * @description All HTML related classes involved in the editing area
21
+ * @param {__se__EditorCore} editor - The root editor instance
22
+ */
23
+ constructor(editor: __se__EditorCore);
24
+ fontSizeUnitRegExp: RegExp;
25
+ _isAllowedClassName: any;
26
+ _allowHTMLComment: any;
27
+ _disallowedStyleNodesRegExp: RegExp;
28
+ _htmlCheckWhitelistRegExp: RegExp;
29
+ _htmlCheckBlacklistRegExp: RegExp;
30
+ _elementWhitelistRegExp: RegExp;
31
+ _elementBlacklistRegExp: RegExp;
32
+ /** @type {Object<string, RegExp>} */
33
+ _attributeWhitelist: {
34
+ [x: string]: RegExp;
35
+ };
36
+ /** @type {Object<string, RegExp>} */
37
+ _attributeBlacklist: {
38
+ [x: string]: RegExp;
39
+ };
40
+ _attributeWhitelistRegExp: RegExp;
41
+ _attributeBlacklistRegExp: RegExp;
42
+ _cleanStyleTagKeyRegExp: RegExp;
43
+ _cleanStyleRegExpMap: Map<any, any>;
44
+ _textStyleTags: any;
45
+ /** @type {Object<string, *>} */
46
+ _autoStyleify: {
47
+ [x: string]: any;
48
+ };
49
+ __disallowedTagsRegExp: RegExp;
50
+ __disallowedTagNameRegExp: RegExp;
51
+ __allowedTagNameRegExp: RegExp;
52
+ /**
53
+ * @this {HTMLThis}
54
+ * @description Filters an HTML string based on allowed and disallowed tags, with optional custom validation.
55
+ * - Removes blacklisted tags and keeps only whitelisted tags.
56
+ * - Allows custom validation functions to replace, modify, or remove elements.
57
+ * @param {string} html - The HTML string to be filtered.
58
+ * @param {Object} params - Filtering parameters.
59
+ * @param {string} [params.tagWhitelist] - Allowed tags, specified as a string with tags separated by '|'. (e.g. "div|p|span").
60
+ * @param {string} [params.tagBlacklist] - Disallowed tags, specified as a string with tags separated by '|'. (e.g. "script|iframe").
61
+ * @param {(node: Node) => Node | string | null} [params.validate] - Function to validate and modify individual nodes.
62
+ * - Return `null` to remove the node.
63
+ * - Return a `Node` to replace the current node.
64
+ * - Return a `string` to replace the node's outerHTML.
65
+ * @param {boolean} [params.validateAll] - Whether to apply validation to all nodes.
66
+ * @returns {string} - The filtered HTML string.
67
+ */
68
+ filter(
69
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
70
+ html: string,
71
+ {
72
+ tagWhitelist,
73
+ tagBlacklist,
74
+ validate,
75
+ validateAll
76
+ }: {
77
+ tagWhitelist?: string;
78
+ tagBlacklist?: string;
79
+ validate?: (node: Node) => Node | string | null;
80
+ validateAll?: boolean;
81
+ }
82
+ ): string;
83
+ /**
84
+ * @this {HTMLThis}
85
+ * @description Cleans and compresses HTML code to suit the editor format.
86
+ * @param {string} html HTML string to clean and compress
87
+ * @param {Object} [options] Cleaning options
88
+ * @param {boolean} [options.forceFormat=false] If true, wraps text nodes without a format node in the format tag.
89
+ * @param {string|RegExp|null} [options.whitelist=null] Regular expression of allowed tags.
90
+ * Create RegExp object using helper.converter.createElementWhitelist method.
91
+ * @param {string|RegExp|null} [options.blacklist=null] Regular expression of disallowed tags.
92
+ * Create RegExp object using helper.converter.createElementBlacklist method.
93
+ * @param {boolean} [options._freeCodeViewMode=false] If true, the free code view mode is enabled.
94
+ * @returns {string} Cleaned and compressed HTML string
95
+ */
96
+ clean(
97
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
98
+ html: string,
99
+ {
100
+ forceFormat,
101
+ whitelist,
102
+ blacklist,
103
+ _freeCodeViewMode
104
+ }?: {
105
+ forceFormat?: boolean;
106
+ whitelist?: string | RegExp | null;
107
+ blacklist?: string | RegExp | null;
108
+ _freeCodeViewMode?: boolean;
109
+ }
110
+ ): string;
111
+ /**
112
+ * @this {HTMLThis}
113
+ * @description Inserts an (HTML element / HTML string / plain string) at the selection range.
114
+ * - If "frameOptions.get('charCounter_max')" is exceeded when "html" is added, null is returned without addition.
115
+ * @param {Node|string} html HTML Element or HTML string or plain string
116
+ * @param {Object} [options] Options
117
+ * @param {boolean} [options.selectInserted=false] If true, selects the range of the inserted node.
118
+ * @param {boolean} [options.skipCharCount=false] If true, inserts even if "frameOptions.get('charCounter_max')" is exceeded.
119
+ * @param {boolean} [options.skipCleaning=false] If true, inserts the HTML string without refining it with html.clean.
120
+ * @returns {HTMLElement|null} The inserted element or null if insertion failed
121
+ */
122
+ insert(
123
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
124
+ html: Node | string,
125
+ {
126
+ selectInserted,
127
+ skipCharCount,
128
+ skipCleaning
129
+ }?: {
130
+ selectInserted?: boolean;
131
+ skipCharCount?: boolean;
132
+ skipCleaning?: boolean;
133
+ }
134
+ ): HTMLElement | null;
135
+ /**
136
+ * @this {HTMLThis}
137
+ * @description Delete selected node and insert argument value node and return.
138
+ * - If the "afterNode" exists, it is inserted after the "afterNode"
139
+ * - Inserting a text node merges with both text nodes on both sides and returns a new "{ container, startOffset, endOffset }".
140
+ * @param {Node} oNode Node to be inserted
141
+ * @param {Object} [options] Options
142
+ * @param {Node} [options.afterNode=null] If the node exists, it is inserted after the node
143
+ * @param {boolean} [options.skipCharCount=null] If true, it will be inserted even if "frameOptions.get('charCounter_max')" is exceeded.
144
+ * @returns {Object|Node|null}
145
+ */
146
+ insertNode(
147
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
148
+ oNode: Node,
149
+ {
150
+ afterNode,
151
+ skipCharCount
152
+ }?: {
153
+ afterNode?: Node;
154
+ skipCharCount?: boolean;
155
+ }
156
+ ): any | Node | null;
157
+ /**
158
+ * @this {HTMLThis}
159
+ * @description Delete the selected range.
160
+ * @returns {{container: Node, offset: number, commonCon?: Node|null, prevContainer?: Node|null}}
161
+ * - container: "the last element after deletion"
162
+ * - offset: "offset"
163
+ * - commonCon: "commonAncestorContainer"
164
+ * - prevContainer: "previousElementSibling Of the deleted area"
165
+ */
166
+ remove(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>): {
167
+ container: Node;
168
+ offset: number;
169
+ commonCon?: Node | null;
170
+ prevContainer?: Node | null;
171
+ };
172
+ /**
173
+ * @this {HTMLThis}
174
+ * @description Gets the current content
175
+ * @param {Object} [options] Options
176
+ * @param {boolean} [options.withFrame=false] Gets the current content with containing parent div.sun-editor-editable (<div class="sun-editor-editable">{content}</div>).
177
+ * Ignored for targetOptions.get('iframe_fullPage') is true.
178
+ * @param {boolean} [options.includeFullPage=false] Return only the content of the body without headers when the "iframe_fullPage" option is true
179
+ * @param {number|Array<number>} [options.rootKey=null] Root index
180
+ * @returns {string|Object<*, string>}
181
+ */
182
+ get(
183
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
184
+ {
185
+ withFrame,
186
+ includeFullPage,
187
+ rootKey
188
+ }?: {
189
+ withFrame?: boolean;
190
+ includeFullPage?: boolean;
191
+ rootKey?: number | Array<number>;
192
+ }
193
+ ): string | any;
194
+ /**
195
+ * @this {HTMLThis}
196
+ * @description Sets the HTML string
197
+ * @param {string} html HTML string
198
+ * @param {Object} [options] Options
199
+ * @param {number|Array<number>} [options.rootKey=null] Root index
200
+ */
201
+ set(
202
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
203
+ html: string,
204
+ {
205
+ rootKey
206
+ }?: {
207
+ rootKey?: number | Array<number>;
208
+ }
209
+ ): void;
210
+ /**
211
+ * @this {HTMLThis}
212
+ * @description Add content to the end of content.
213
+ * @param {string} html Content to Input
214
+ * @param {Object} [options] Options
215
+ * @param {number|Array<number>} [options.rootKey=null] Root index
216
+ */
217
+ add(
218
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
219
+ html: string,
220
+ {
221
+ rootKey
222
+ }?: {
223
+ rootKey?: number | Array<number>;
224
+ }
225
+ ): void;
226
+ /**
227
+ * @this {HTMLThis}
228
+ * @description Sets the content of the iframe's head tag and body tag when using the "iframe" or "iframe_fullPage" option.
229
+ * @param {{head: string, body: string}} ctx { head: HTML string, body: HTML string}
230
+ * @param {Object} [options] Options
231
+ * @param {number|Array<number>} [options.rootKey=null] Root index
232
+ */
233
+ setFullPage(
234
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
235
+ ctx: {
236
+ head: string;
237
+ body: string;
238
+ },
239
+ {
240
+ rootKey
241
+ }?: {
242
+ rootKey?: number | Array<number>;
243
+ }
244
+ ): boolean;
245
+ /**
246
+ * @this {HTMLThis}
247
+ * @description HTML code compression
248
+ * @param {string} html HTML string
249
+ * @returns {string} HTML string
250
+ */
251
+ compress(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: string): string;
252
+ /**
253
+ * @private
254
+ * @this {HTMLThis}
255
+ * @description construct wysiwyg area element to html string
256
+ * @param {Node|string} html WYSIWYG element (this.editor.frameContext.get('wysiwyg')) or HTML string.
257
+ * @param {boolean} comp If true, does not line break and indentation of tags.
258
+ * @returns {string}
259
+ */
260
+ _convertToCode(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: Node | string, comp: boolean): string;
261
+ /**
262
+ * @private
263
+ * @this {HTMLThis}
264
+ * @description Checks whether the given list item node should be removed and handles necessary clean-up.
265
+ * @param {Node} item The list item node to be checked.
266
+ */
267
+ _nodeRemoveListItem(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, item: Node): void;
268
+ /**
269
+ * @private
270
+ * @this {HTMLThis}
271
+ * @description Recursive function when used to place a node in "BrLine" in "html.insertNode"
272
+ * @param {Node} oNode Node to be inserted
273
+ * @returns {Node} "oNode"
274
+ */
275
+ _setIntoFreeFormat(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, oNode: Node): Node;
276
+ /**
277
+ * @private
278
+ * @this {HTMLThis}
279
+ * @description Returns HTML string according to tag type and configurati isExcludeFormat.
280
+ * @param {Node} node Node
281
+ * @param {boolean} forceFormat If true, text nodes that do not have a format node is wrapped with the format tag.
282
+ */
283
+ _makeLine(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, node: Node, forceFormat: boolean): string;
284
+ /**
285
+ * @private
286
+ * @this {HTMLThis}
287
+ * @description Fix tags that do not fit the editor format.
288
+ * @param {DocumentFragment} documentFragment Document fragment "DOCUMENT_FRAGMENT_NODE" (nodeType === 11)
289
+ * @param {RegExp} htmlCheckWhitelistRegExp Editor tags whitelist
290
+ * @param {RegExp} htmlCheckBlacklistRegExp Editor tags blacklist
291
+ * @param {boolean} tagFilter Tag filter option
292
+ * @param {boolean} formatFilter Format filter option
293
+ * @param {boolean} classFilter Class name filter option
294
+ * @param {boolean} _freeCodeViewMode Enforces strict HTML validation based on the editor`s policy
295
+ */
296
+ _consistencyCheckOfHTML(
297
+ this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
298
+ documentFragment: DocumentFragment,
299
+ htmlCheckWhitelistRegExp: RegExp,
300
+ htmlCheckBlacklistRegExp: RegExp,
301
+ tagFilter: boolean,
302
+ formatFilter: boolean,
303
+ classFilter: boolean,
304
+ _freeCodeViewMode: boolean
305
+ ): void;
306
+ /**
307
+ * @private
308
+ * @this {HTMLThis}
309
+ * @description Removes attribute values such as style and converts tags that do not conform to the "html5" standard.
310
+ * @param {string} html HTML string
311
+ * @returns {string} HTML string
312
+ */
313
+ _styleNodeConvertor(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: string): string;
314
+ /**
315
+ * @private
316
+ * @this {HTMLThis}
317
+ * @description Determines if formatting is required and returns a domTree
318
+ * @param {DocumentFragment} domFrag documentFragment
319
+ * @returns {DocumentFragment}
320
+ */
321
+ _editFormat(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, domFrag: DocumentFragment): DocumentFragment;
322
+ /**
323
+ * @private
324
+ * @this {HTMLThis}
325
+ * @description Converts a list of DOM nodes into an HTML list structure.
326
+ * - If the node is already a list, its innerHTML is used. If it is a block element,
327
+ * - the function is called recursively.
328
+ * @param {__se__NodeCollection} domTree List of DOM nodes to be converted.
329
+ * @returns {string} The generated HTML list.
330
+ */
331
+ _convertListCell(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, domTree: __se__NodeCollection): string;
332
+ /**
333
+ * @private
334
+ * @this {HTMLThis}
335
+ * @description Checks whether the provided DOM nodes require formatting.
336
+ * @param {NodeList} domTree List of DOM nodes to check.
337
+ * @returns {boolean} True if formatting is required, otherwise false.
338
+ */
339
+ _isFormatData(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, domTree: NodeList): boolean;
340
+ /**
341
+ * @private
342
+ * @this {HTMLThis}
343
+ * @description Cleans the inline style attributes of an HTML element.
344
+ * - Extracts allowed styles and removes disallowed ones based on editor settings.
345
+ * @param {string} m The full matched string from a regular expression.
346
+ * @param {Array|null} v The list of allowed attributes.
347
+ * @param {string} name The tag name of the element being cleaned.
348
+ * @returns {Array} The updated list of allowed attributes including cleaned styles.
349
+ */
350
+ _cleanStyle(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, m: string, v: any[] | null, name: string): any[];
351
+ /**
352
+ * @private
353
+ * @this {HTMLThis}
354
+ * @description Delete disallowed tags
355
+ * @param {string} html HTML string
356
+ * @returns {string}
357
+ */
358
+ _deleteDisallowedTags(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: string, whitelistRegExp: any, blacklistRegExp: any): string;
359
+ /**
360
+ * @private
361
+ * @this {HTMLThis}
362
+ * @description Recursively checks for duplicate text style nodes within a given parent node.
363
+ * @param {Node} oNode The node to check for duplicate styles.
364
+ * @param {Node} parentNode The parent node where the duplicate check occurs.
365
+ */
366
+ _checkDuplicateNode(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, oNode: Node, parentNode: Node): void;
367
+ /**
368
+ * @private
369
+ * @this {HTMLThis}
370
+ * @description Recursively checks for duplicate text style nodes within a given parent node.
371
+ * - If duplicate styles are found, redundant attributes are removed.
372
+ * @param {Node} oNode The node to check for duplicate styles.
373
+ * @param {Node} parentNode The parent node where the duplicate check occurs.
374
+ * @returns {Node} The cleaned node with redundant styles removed.
375
+ */
376
+ _dupleCheck(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, oNode: Node, parentNode: Node): Node;
377
+ }
@@ -0,0 +1,118 @@
1
+ export default Menu;
2
+ export type MenuThis = Omit<Menu & Partial<__se__EditorInjector>, 'menu'>;
3
+ /**
4
+ * @typedef {Omit<Menu & Partial<__se__EditorInjector>, 'menu'>} MenuThis
5
+ */
6
+ /**
7
+ * @constructor
8
+ * @this {MenuThis}
9
+ * @description Dropdown and container menu management class
10
+ * @param {__se__EditorCore} editor - The root editor instance
11
+ */
12
+ declare function Menu(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, editor: __se__EditorCore): void;
13
+ declare class Menu {
14
+ /**
15
+ * @typedef {Omit<Menu & Partial<__se__EditorInjector>, 'menu'>} MenuThis
16
+ */
17
+ /**
18
+ * @constructor
19
+ * @this {MenuThis}
20
+ * @description Dropdown and container menu management class
21
+ * @param {__se__EditorCore} editor - The root editor instance
22
+ */
23
+ constructor(editor: __se__EditorCore);
24
+ /** @type {Object<string, HTMLElement>} */
25
+ targetMap: {
26
+ [x: string]: HTMLElement;
27
+ };
28
+ index: number;
29
+ menus: any[];
30
+ currentDropdown: HTMLElement;
31
+ currentDropdownActiveButton: HTMLButtonElement;
32
+ currentDropdownName: string;
33
+ currentDropdownType: string;
34
+ currentContainer: HTMLElement;
35
+ currentContainerActiveButton: HTMLButtonElement;
36
+ currentContainerName: string;
37
+ _dropdownCommands: any[];
38
+ __globalEventHandler: {
39
+ mousedown: any;
40
+ containerDown: any;
41
+ keydown: any;
42
+ mousemove: any;
43
+ mouseout: any;
44
+ };
45
+ _bindClose_dropdown_mouse: any;
46
+ _bindClose_dropdown_key: any;
47
+ _bindClose_cons_mouse: any;
48
+ currentDropdownPlugin: any;
49
+ /**
50
+ * @this {MenuThis}
51
+ * @description Method for managing dropdown element.
52
+ * - You must add the "dropdown" element using the this method at custom plugin.
53
+ * @param {{key: string, type: string}} classObj Class object
54
+ * @param {Node} menu Dropdown element
55
+ */
56
+ initDropdownTarget(
57
+ this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>,
58
+ {
59
+ key,
60
+ type
61
+ }: {
62
+ key: string;
63
+ type: string;
64
+ },
65
+ menu: Node
66
+ ): void;
67
+ /**
68
+ * @this {MenuThis}
69
+ * @description On dropdown
70
+ * @param {Node} button Dropdown's button element to call
71
+ */
72
+ dropdownOn(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, button: Node): void;
73
+ /**
74
+ * @this {MenuThis}
75
+ * @description Off dropdown
76
+ */
77
+ dropdownOff(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>): void;
78
+ /**
79
+ * @this {MenuThis}
80
+ * @description On menu container
81
+ * @param {Node} button Container's button element to call
82
+ */
83
+ containerOn(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, button: Node): void;
84
+ /**
85
+ * @this {MenuThis}
86
+ * @description Off menu container
87
+ */
88
+ containerOff(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>): void;
89
+ /**
90
+ * @private
91
+ * @this {MenuThis}
92
+ * @description Set the menu position.
93
+ * @param {Node} element Button element
94
+ * @param {HTMLElement} menu Menu element
95
+ */
96
+ _setMenuPosition(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, element: Node, menu: HTMLElement): void;
97
+ /**
98
+ * @private
99
+ * @this {MenuThis}
100
+ * @description Check if the element is part of a more layer
101
+ * @param {Node} element The element to check
102
+ * @returns {HTMLElement|null} The more layer element or null
103
+ */
104
+ _checkMoreLayer(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, element: Node): HTMLElement | null;
105
+ /**
106
+ * @private
107
+ * @this {MenuThis}
108
+ * @description Move the selected item in the dropdown menu
109
+ * @param {number} num Direction and amount to move (-1 for up, 1 for down)
110
+ */
111
+ _moveItem(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, num: number): void;
112
+ /**
113
+ * @private
114
+ * @this {MenuThis}
115
+ * @description Remove global event listeners
116
+ */
117
+ __removeGlobalEvent(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>): void;
118
+ }
@@ -0,0 +1,93 @@
1
+ export default NodeTransform;
2
+ export type NodeTransformThis = Omit<NodeTransform & Partial<__se__EditorInjector>, 'nodeTransform'>;
3
+ /**
4
+ * @typedef {Omit<NodeTransform & Partial<__se__EditorInjector>, 'nodeTransform'>} NodeTransformThis
5
+ */
6
+ /**
7
+ * @constructor
8
+ * @this {NodeTransformThis}
9
+ * @description Node utility class. split, merge, etc.
10
+ * @param {__se__EditorCore} editor - The root editor instance
11
+ */
12
+ declare function NodeTransform(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, editor: __se__EditorCore): void;
13
+ declare class NodeTransform {
14
+ /**
15
+ * @typedef {Omit<NodeTransform & Partial<__se__EditorInjector>, 'nodeTransform'>} NodeTransformThis
16
+ */
17
+ /**
18
+ * @constructor
19
+ * @this {NodeTransformThis}
20
+ * @description Node utility class. split, merge, etc.
21
+ * @param {__se__EditorCore} editor - The root editor instance
22
+ */
23
+ constructor(editor: __se__EditorCore);
24
+ /**
25
+ * @this {NodeTransformThis}
26
+ * @template {HTMLElement} T
27
+ * @description Split all tags based on "baseNode"
28
+ * @param {Node} baseNode Element or text node on which to base
29
+ * @param {?number|Node} offset Text offset of "baseNode" (Only valid when "baseNode" is a text node)
30
+ * @param {number} [depth=0] The nesting depth of the element being split. (default: 0)
31
+ * @returns {T} The last element of the splited tag.
32
+ */
33
+ split<T extends HTMLElement>(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, baseNode: Node, offset: (number | Node) | null, depth?: number): T;
34
+ /**
35
+ * @this {NodeTransformThis}
36
+ * @description Use with "npdePath (dom-query-GetNodePath)" to merge the same attributes and tags if they are present and modify the nodepath.
37
+ * - If "offset" has been changed, it will return as much "offset" as it has been modified.
38
+ * - An array containing change offsets is returned in the order of the "nodePathArray" array.
39
+ * @param {Node} element Element
40
+ * @param {?number[][]=} nodePathArray Array of NodePath object ([dom-query-GetNodePath(), ..])
41
+ * @param {?boolean=} onlyText If true, non-text nodes like 'span', 'strong'.. are ignored.
42
+ * @returns {Array<number>} [offset, ..]
43
+ */
44
+ mergeSameTags(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, element: Node, nodePathArray?: (number[][] | null) | undefined, onlyText?: (boolean | null) | undefined): Array<number>;
45
+ /**
46
+ * @this {NodeTransformThis}
47
+ * @description Remove nested tags without other child nodes.
48
+ * @param {Node} element Element object
49
+ * @param {?(current: Node) => boolean|string=} validation Validation function / String("tag1|tag2..") / If null, all tags are applicable.
50
+ */
51
+ mergeNestedTags(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, element: Node, validation?: (((current: Node) => boolean | string) | null) | undefined): void;
52
+ /**
53
+ * @this {NodeTransformThis}
54
+ * @description Delete itself and all parent nodes that match the condition.
55
+ * - Returns an {sc: previousSibling, ec: nextSibling}(the deleted node reference) or null.
56
+ * @param {Node} item Node to be remove
57
+ * @param {?(current: Node) => boolean=} validation Validation function. default(Deleted if it only have breakLine and blanks)
58
+ * @param {?Node=} stopParent Stop when the parent node reaches stopParent
59
+ * @returns {{sc: Node|null, ec: Node|null}|null} {sc: previousSibling, ec: nextSibling} (the deleted node reference) or null.
60
+ */
61
+ removeAllParents(
62
+ this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>,
63
+ item: Node,
64
+ validation?: (((current: Node) => boolean) | null) | undefined,
65
+ stopParent?: (Node | null) | undefined
66
+ ): {
67
+ sc: Node | null;
68
+ ec: Node | null;
69
+ } | null;
70
+ /**
71
+ * @this {NodeTransformThis}
72
+ * @description Delete a empty child node of argument element
73
+ * @param {Node} element Element node
74
+ * @param {?Node} notRemoveNode Do not remove node
75
+ * @param {boolean} forceDelete When all child nodes are deleted, the parent node is also deleted.
76
+ */
77
+ removeEmptyNode(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, element: Node, notRemoveNode: Node | null, forceDelete: boolean): void;
78
+ /**
79
+ * @this {NodeTransformThis}
80
+ * @description Creates a nested node structure from the given array of nodes.
81
+ * @param {__se__NodeCollection} nodeArray An array of nodes to clone. The first node in the array will be the top-level parent.
82
+ * @param {?(current: Node) => boolean=} validate A validate function.
83
+ * @returns {{ parent: Node, inner: Node }} An object containing the top-level parent node and the innermost child node.
84
+ */
85
+ createNestedNode(
86
+ this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>,
87
+ nodeArray: __se__NodeCollection,
88
+ validate?: (((current: Node) => boolean) | null) | undefined
89
+ ): {
90
+ parent: Node;
91
+ inner: Node;
92
+ };
93
+ }