suneditor 2.46.2 → 3.0.0-alpha.10

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 (290) hide show
  1. package/.eslintignore +7 -0
  2. package/.eslintrc.json +64 -0
  3. package/CONTRIBUTING.md +36 -0
  4. package/LICENSE.txt +1 -1
  5. package/README.md +11 -1560
  6. package/dist/suneditor.min.css +1 -0
  7. package/dist/suneditor.min.js +1 -2
  8. package/package.json +97 -70
  9. package/src/assets/icons/_default.js +194 -0
  10. package/src/assets/suneditor-contents.css +643 -0
  11. package/src/assets/suneditor.css +3394 -0
  12. package/src/core/base/eventHandlers/handler_toolbar.js +114 -0
  13. package/src/core/base/eventHandlers/handler_ww_clipboard.js +37 -0
  14. package/src/core/base/eventHandlers/handler_ww_dragDrop.js +74 -0
  15. package/src/core/base/eventHandlers/handler_ww_key_input.js +1002 -0
  16. package/src/core/base/eventHandlers/handler_ww_mouse.js +147 -0
  17. package/src/core/base/eventManager.js +1156 -0
  18. package/src/core/base/events.js +320 -0
  19. package/src/core/base/history.js +301 -0
  20. package/src/core/class/char.js +147 -0
  21. package/src/core/class/component.js +639 -0
  22. package/src/core/class/format.js +3258 -0
  23. package/src/core/class/html.js +1710 -0
  24. package/src/core/class/menu.js +260 -0
  25. package/src/core/class/nodeTransform.js +405 -0
  26. package/src/core/class/notice.js +42 -0
  27. package/src/core/class/offset.js +575 -0
  28. package/src/core/class/selection.js +511 -0
  29. package/src/core/class/shortcuts.js +38 -0
  30. package/src/core/class/toolbar.js +440 -0
  31. package/src/core/class/viewer.js +646 -0
  32. package/src/core/editor.js +1601 -0
  33. package/src/core/section/actives.js +145 -0
  34. package/src/core/section/constructor.js +1252 -0
  35. package/src/core/section/context.js +97 -0
  36. package/src/editorInjector/_classes.js +22 -0
  37. package/src/editorInjector/_core.js +28 -0
  38. package/src/editorInjector/index.js +13 -0
  39. package/src/helper/converter.js +388 -0
  40. package/src/helper/domUtils.js +1177 -0
  41. package/src/helper/env.js +250 -0
  42. package/src/helper/index.js +19 -0
  43. package/src/helper/numbers.js +68 -0
  44. package/src/helper/unicode.js +43 -0
  45. package/src/langs/ckb.js +161 -0
  46. package/src/langs/cs.js +161 -0
  47. package/src/langs/da.js +161 -0
  48. package/src/langs/de.js +162 -0
  49. package/src/langs/en.js +210 -0
  50. package/src/langs/es.js +162 -0
  51. package/src/langs/fa.js +159 -0
  52. package/src/langs/fr.js +161 -0
  53. package/src/langs/he.js +162 -0
  54. package/src/{lang → langs}/index.js +0 -2
  55. package/src/langs/it.js +162 -0
  56. package/src/langs/ja.js +162 -0
  57. package/src/langs/ko.js +210 -0
  58. package/src/langs/lv.js +162 -0
  59. package/src/langs/nl.js +162 -0
  60. package/src/langs/pl.js +162 -0
  61. package/src/langs/pt_br.js +162 -0
  62. package/src/langs/ro.js +162 -0
  63. package/src/langs/ru.js +162 -0
  64. package/src/langs/se.js +162 -0
  65. package/src/langs/tr.js +159 -0
  66. package/src/langs/ua.js +162 -0
  67. package/src/langs/ur.js +162 -0
  68. package/src/langs/zh_cn.js +162 -0
  69. package/src/modules/ApiManager.js +168 -0
  70. package/src/modules/ColorPicker.js +302 -0
  71. package/src/modules/Controller.js +323 -0
  72. package/src/modules/Figure.js +1176 -0
  73. package/src/modules/FileBrowser.js +271 -0
  74. package/src/modules/FileManager.js +307 -0
  75. package/src/modules/HueSlider.js +513 -0
  76. package/src/modules/Modal.js +177 -0
  77. package/src/modules/ModalAnchorEditor.js +494 -0
  78. package/src/modules/SelectMenu.js +447 -0
  79. package/src/modules/_DragHandle.js +16 -0
  80. package/src/modules/index.js +14 -0
  81. package/src/plugins/command/blockquote.js +47 -47
  82. package/src/plugins/command/exportPdf.js +168 -0
  83. package/src/plugins/command/fileUpload.js +389 -0
  84. package/src/plugins/command/list_bulleted.js +112 -0
  85. package/src/plugins/command/list_numbered.js +115 -0
  86. package/src/plugins/dropdown/align.js +143 -0
  87. package/src/plugins/dropdown/backgroundColor.js +90 -0
  88. package/src/plugins/dropdown/font.js +113 -0
  89. package/src/plugins/dropdown/fontColor.js +90 -0
  90. package/src/plugins/dropdown/formatBlock.js +141 -0
  91. package/src/plugins/dropdown/hr.js +111 -0
  92. package/src/plugins/dropdown/layout.js +72 -0
  93. package/src/plugins/dropdown/lineHeight.js +114 -0
  94. package/src/plugins/dropdown/list.js +107 -0
  95. package/src/plugins/dropdown/paragraphStyle.js +117 -0
  96. package/src/plugins/dropdown/table.js +2810 -0
  97. package/src/plugins/dropdown/template.js +71 -0
  98. package/src/plugins/dropdown/textStyle.js +137 -0
  99. package/src/plugins/field/mention.js +181 -0
  100. package/src/plugins/fileBrowser/imageGallery.js +76 -59
  101. package/src/plugins/index.js +86 -24
  102. package/src/plugins/input/fontSize.js +357 -0
  103. package/src/plugins/modal/audio.js +492 -0
  104. package/src/plugins/modal/image.js +1064 -0
  105. package/src/plugins/modal/link.js +211 -0
  106. package/src/plugins/modal/math.js +363 -0
  107. package/src/plugins/modal/video.js +870 -0
  108. package/src/suneditor.js +62 -67
  109. package/src/themes/test.css +61 -0
  110. package/typings/CommandPlugin.d.ts +8 -0
  111. package/typings/DialogPlugin.d.ts +20 -0
  112. package/typings/FileBrowserPlugin.d.ts +30 -0
  113. package/typings/Lang.d.ts +124 -0
  114. package/typings/Module.d.ts +15 -0
  115. package/typings/Plugin.d.ts +42 -0
  116. package/typings/SubmenuPlugin.d.ts +8 -0
  117. package/typings/_classes.d.ts +17 -0
  118. package/typings/_colorPicker.d.ts +60 -0
  119. package/typings/_core.d.ts +55 -0
  120. package/typings/align.d.ts +5 -0
  121. package/{src/plugins/dialog → typings}/audio.d.ts +1 -1
  122. package/typings/backgroundColor.d.ts +5 -0
  123. package/{src/plugins/command → typings}/blockquote.d.ts +1 -1
  124. package/typings/char.d.ts +39 -0
  125. package/typings/component.d.ts +38 -0
  126. package/typings/context.d.ts +39 -0
  127. package/typings/converter.d.ts +33 -0
  128. package/typings/dialog.d.ts +28 -0
  129. package/typings/domUtils.d.ts +361 -0
  130. package/typings/editor.d.ts +7 -0
  131. package/typings/editor.ts +542 -0
  132. package/typings/env.d.ts +70 -0
  133. package/typings/eventManager.d.ts +37 -0
  134. package/typings/events.d.ts +262 -0
  135. package/typings/fileBrowser.d.ts +42 -0
  136. package/typings/fileManager.d.ts +67 -0
  137. package/typings/font.d.ts +5 -0
  138. package/typings/fontColor.d.ts +5 -0
  139. package/typings/fontSize.d.ts +5 -0
  140. package/typings/format.d.ts +191 -0
  141. package/typings/formatBlock.d.ts +5 -0
  142. package/typings/history.d.ts +48 -0
  143. package/typings/horizontalRule.d.ts +5 -0
  144. package/{src/plugins/dialog → typings}/image.d.ts +1 -1
  145. package/{src/plugins/fileBrowser → typings}/imageGallery.d.ts +1 -1
  146. package/typings/index.d.ts +21 -0
  147. package/{src/plugins/modules/index.d.ts → typings/index.modules.d.ts} +3 -3
  148. package/typings/index.plugins.d.ts +58 -0
  149. package/typings/lineHeight.d.ts +5 -0
  150. package/{src/plugins/dialog → typings}/link.d.ts +1 -1
  151. package/typings/list.d.ts +5 -0
  152. package/{src/plugins/dialog → typings}/math.d.ts +1 -1
  153. package/typings/mediaContainer.d.ts +25 -0
  154. package/typings/node.d.ts +57 -0
  155. package/typings/notice.d.ts +16 -0
  156. package/typings/numbers.d.ts +29 -0
  157. package/typings/offset.d.ts +24 -0
  158. package/typings/options.d.ts +589 -0
  159. package/typings/paragraphStyle.d.ts +5 -0
  160. package/typings/resizing.d.ts +141 -0
  161. package/typings/selection.d.ts +94 -0
  162. package/typings/shortcuts.d.ts +13 -0
  163. package/typings/suneditor.d.ts +9 -0
  164. package/typings/table.d.ts +5 -0
  165. package/typings/template.d.ts +5 -0
  166. package/typings/textStyle.d.ts +5 -0
  167. package/typings/toolbar.d.ts +32 -0
  168. package/typings/unicode.d.ts +25 -0
  169. package/{src/plugins/dialog → typings}/video.d.ts +1 -1
  170. package/dist/css/suneditor.min.css +0 -1
  171. package/src/assets/css/suneditor-contents.css +0 -562
  172. package/src/assets/css/suneditor.css +0 -566
  173. package/src/assets/defaultIcons.js +0 -103
  174. package/src/lang/Lang.d.ts +0 -144
  175. package/src/lang/ckb.d.ts +0 -5
  176. package/src/lang/ckb.js +0 -188
  177. package/src/lang/cs.d.ts +0 -5
  178. package/src/lang/cs.js +0 -188
  179. package/src/lang/da.d.ts +0 -5
  180. package/src/lang/da.js +0 -191
  181. package/src/lang/de.d.ts +0 -5
  182. package/src/lang/de.js +0 -188
  183. package/src/lang/en.d.ts +0 -5
  184. package/src/lang/en.js +0 -188
  185. package/src/lang/es.d.ts +0 -5
  186. package/src/lang/es.js +0 -188
  187. package/src/lang/fa.d.ts +0 -5
  188. package/src/lang/fa.js +0 -188
  189. package/src/lang/fr.d.ts +0 -5
  190. package/src/lang/fr.js +0 -188
  191. package/src/lang/he.d.ts +0 -5
  192. package/src/lang/he.js +0 -188
  193. package/src/lang/index.d.ts +0 -23
  194. package/src/lang/it.d.ts +0 -5
  195. package/src/lang/it.js +0 -188
  196. package/src/lang/ja.d.ts +0 -5
  197. package/src/lang/ja.js +0 -188
  198. package/src/lang/ko.d.ts +0 -5
  199. package/src/lang/ko.js +0 -188
  200. package/src/lang/lv.d.ts +0 -5
  201. package/src/lang/lv.js +0 -188
  202. package/src/lang/nl.d.ts +0 -5
  203. package/src/lang/nl.js +0 -188
  204. package/src/lang/pl.d.ts +0 -5
  205. package/src/lang/pl.js +0 -188
  206. package/src/lang/pt_br.d.ts +0 -5
  207. package/src/lang/pt_br.js +0 -189
  208. package/src/lang/ro.d.ts +0 -5
  209. package/src/lang/ro.js +0 -188
  210. package/src/lang/ru.d.ts +0 -5
  211. package/src/lang/ru.js +0 -188
  212. package/src/lang/se.d.ts +0 -5
  213. package/src/lang/se.js +0 -191
  214. package/src/lang/tr.d.ts +0 -5
  215. package/src/lang/tr.js +0 -191
  216. package/src/lang/ua.d.ts +0 -5
  217. package/src/lang/ua.js +0 -188
  218. package/src/lang/ur.d.ts +0 -5
  219. package/src/lang/ur.js +0 -188
  220. package/src/lang/zh_cn.d.ts +0 -5
  221. package/src/lang/zh_cn.js +0 -187
  222. package/src/lib/constructor.js +0 -954
  223. package/src/lib/context.d.ts +0 -42
  224. package/src/lib/context.js +0 -71
  225. package/src/lib/core.d.ts +0 -1135
  226. package/src/lib/core.js +0 -9395
  227. package/src/lib/history.d.ts +0 -48
  228. package/src/lib/history.js +0 -219
  229. package/src/lib/util.d.ts +0 -678
  230. package/src/lib/util.js +0 -2131
  231. package/src/options.d.ts +0 -608
  232. package/src/plugins/CommandPlugin.d.ts +0 -8
  233. package/src/plugins/DialogPlugin.d.ts +0 -20
  234. package/src/plugins/FileBrowserPlugin.d.ts +0 -30
  235. package/src/plugins/Module.d.ts +0 -15
  236. package/src/plugins/Plugin.d.ts +0 -42
  237. package/src/plugins/SubmenuPlugin.d.ts +0 -8
  238. package/src/plugins/dialog/audio.js +0 -559
  239. package/src/plugins/dialog/image.js +0 -1126
  240. package/src/plugins/dialog/link.js +0 -223
  241. package/src/plugins/dialog/math.js +0 -295
  242. package/src/plugins/dialog/mention.js +0 -242
  243. package/src/plugins/dialog/video.js +0 -979
  244. package/src/plugins/index.d.ts +0 -79
  245. package/src/plugins/modules/_anchor.js +0 -461
  246. package/src/plugins/modules/_colorPicker.d.ts +0 -60
  247. package/src/plugins/modules/_colorPicker.js +0 -201
  248. package/src/plugins/modules/_notice.d.ts +0 -21
  249. package/src/plugins/modules/_notice.js +0 -72
  250. package/src/plugins/modules/_selectMenu.js +0 -119
  251. package/src/plugins/modules/component.d.ts +0 -25
  252. package/src/plugins/modules/component.js +0 -81
  253. package/src/plugins/modules/dialog.d.ts +0 -28
  254. package/src/plugins/modules/dialog.js +0 -175
  255. package/src/plugins/modules/fileBrowser.d.ts +0 -42
  256. package/src/plugins/modules/fileBrowser.js +0 -374
  257. package/src/plugins/modules/fileManager.d.ts +0 -67
  258. package/src/plugins/modules/fileManager.js +0 -326
  259. package/src/plugins/modules/index.js +0 -9
  260. package/src/plugins/modules/resizing.d.ts +0 -154
  261. package/src/plugins/modules/resizing.js +0 -903
  262. package/src/plugins/submenu/align.d.ts +0 -5
  263. package/src/plugins/submenu/align.js +0 -160
  264. package/src/plugins/submenu/font.d.ts +0 -5
  265. package/src/plugins/submenu/font.js +0 -123
  266. package/src/plugins/submenu/fontColor.d.ts +0 -5
  267. package/src/plugins/submenu/fontColor.js +0 -101
  268. package/src/plugins/submenu/fontSize.d.ts +0 -5
  269. package/src/plugins/submenu/fontSize.js +0 -112
  270. package/src/plugins/submenu/formatBlock.d.ts +0 -5
  271. package/src/plugins/submenu/formatBlock.js +0 -273
  272. package/src/plugins/submenu/hiliteColor.d.ts +0 -5
  273. package/src/plugins/submenu/hiliteColor.js +0 -102
  274. package/src/plugins/submenu/horizontalRule.d.ts +0 -5
  275. package/src/plugins/submenu/horizontalRule.js +0 -98
  276. package/src/plugins/submenu/lineHeight.d.ts +0 -5
  277. package/src/plugins/submenu/lineHeight.js +0 -104
  278. package/src/plugins/submenu/list.d.ts +0 -5
  279. package/src/plugins/submenu/list.js +0 -456
  280. package/src/plugins/submenu/paragraphStyle.d.ts +0 -5
  281. package/src/plugins/submenu/paragraphStyle.js +0 -135
  282. package/src/plugins/submenu/table.d.ts +0 -5
  283. package/src/plugins/submenu/table.js +0 -1431
  284. package/src/plugins/submenu/template.d.ts +0 -5
  285. package/src/plugins/submenu/template.js +0 -72
  286. package/src/plugins/submenu/textStyle.d.ts +0 -5
  287. package/src/plugins/submenu/textStyle.js +0 -167
  288. package/src/suneditor.d.ts +0 -9
  289. package/src/suneditor_build.js +0 -18
  290. /package/{src/plugins/dialog → typings}/mention.d.ts +0 -0
@@ -0,0 +1,38 @@
1
+ import EditorInterface from '../../interface/editor';
2
+
3
+ class Component extends EditorInterface {
4
+ /**
5
+ * @description The method to insert a element and return. (used elements : table, hr, image, video)
6
+ * If "element" is "HR", insert and return the new line.
7
+ * @param element Element to be inserted
8
+ * @param notHistoryPush When true, it does not update the history stack and the selection object and return EdgeNodes (util.getEdgeChildNodes)
9
+ * @param checkCharCount If true, if "options.charCounter_max" is exceeded when "element" is added, null is returned without addition.
10
+ * @param notSelect If true, Do not automatically select the inserted component.
11
+ * @returns
12
+ */
13
+ insert(element: Element, notHistoryPush?: boolean, checkCharCount?: boolean, notSelect?: boolean): Element;
14
+
15
+ /**
16
+ * @description Gets the file component and that plugin name
17
+ * return: {target, component, pluginName} | null
18
+ * @param element Target element (figure tag, component div, file tag)
19
+ * @returns
20
+ */
21
+ get(element: Element): seledtedFileInfo | null;
22
+
23
+ /**
24
+ * @description The component(image, video) is selected and the resizing module is called.
25
+ * @param element Element tag (img, iframe, video)
26
+ * @param pluginName Plugin name (image, video)
27
+ */
28
+ select(element: Element, pluginName: string): void;
29
+
30
+ /**
31
+ * @description It is judged whether it is the component[img, iframe, video, audio, table] cover(class="se-component") and table, hr
32
+ * @param element The node to check
33
+ * @returns
34
+ */
35
+ is(element: Node): boolean;
36
+ }
37
+
38
+ export default Component;
@@ -0,0 +1,39 @@
1
+ import { SunEditorOptions } from '../src/options';
2
+ import { Plugin } from '../src/plugins/Plugin';
3
+
4
+ declare interface EditorElement {
5
+ originElement: Element;
6
+ topArea: Element;
7
+ relative: Element;
8
+ toolbar: Element;
9
+ statusbar: Element;
10
+ navigation: Element;
11
+ charWrapper: Element;
12
+ charCounter: Element;
13
+ editorArea: Element;
14
+ wysiwygFrame: Element;
15
+ wysiwyg: Element;
16
+ code: Element;
17
+ placeholder: Element;
18
+ loading: Element;
19
+ lineBreaker: Element;
20
+ resizeBackground: Element;
21
+ }
22
+
23
+ export interface Context {
24
+ element: EditorElement;
25
+ tool: Record<string, Element>;
26
+ options: SunEditorOptions;
27
+ option: SunEditorOptions;
28
+ [key: string]: any;
29
+ }
30
+
31
+ type Constructor = {
32
+ constructed: Record<string, Element | null>;
33
+ options: SunEditorOptions;
34
+ plugins: Plugin[];
35
+ pluginCallButtons: Record<string, Element>;
36
+ _icons: Record<string, string>;
37
+ };
38
+
39
+ declare function CreateContext(element: Element, cons: Constructor, options: SunEditorOptions): Context;
@@ -0,0 +1,33 @@
1
+ class converter {
2
+ /**
3
+ * @description Convert HTML string to HTML Entity
4
+ * @param content HTML or Text string
5
+ * @returns
6
+ */
7
+ htmlToEntity(content: string): string;
8
+
9
+ /**
10
+ * @description Convert HTML Entity to HTML string
11
+ * @param content HTML or Text string
12
+ * @returns
13
+ */
14
+ entityToHTML(content: string): string;
15
+
16
+ /**
17
+ * @description Create whitelist RegExp object.
18
+ * Return RegExp format: new RegExp("<\\/?\\b(?!" + list + ")\\b[^>^<]*+>", "gi")
19
+ * @param list Tags list ("br|p|div|pre...")
20
+ * @returns
21
+ */
22
+ createElementWhitelist(list: string): RegExp;
23
+
24
+ /**
25
+ * @description Create blacklist RegExp object.
26
+ * Return RegExp format: new RegExp("<\\/?\\b(?:" + list + ")\\b[^>^<]*+>", "gi")
27
+ * @param list Tags list ("br|p|div|pre...")
28
+ * @returns
29
+ */
30
+ createElementBlacklist(list: string): RegExp;
31
+ }
32
+
33
+ export default converter;
@@ -0,0 +1,28 @@
1
+ import { Module } from '../Module';
2
+
3
+ /**
4
+ * @description This is a required module of dialog plugin.
5
+ */
6
+ declare interface dialog extends Module {
7
+ /**
8
+ * @description Open a Dialog plugin
9
+ * @param kind Dialog plugin name
10
+ * @param update Whether it will open for update ('image' === this.currentControllerName)
11
+ * @example this.plugins.dialog.open.call(this, 'image', 'image' === this.currentControllerName);
12
+ */
13
+ open(kind: string, update: boolean): void;
14
+
15
+ /**
16
+ * @description Called after the dropdown has been rendered
17
+ */
18
+ on?: () => void;
19
+
20
+ /**
21
+ * @description Close a Dialog plugin
22
+ * The plugin's "init" method is called.
23
+ * @example this.plugins.dialog.close.call(this);
24
+ */
25
+ close(): void;
26
+ }
27
+
28
+ export default dialog;
@@ -0,0 +1,361 @@
1
+ class domUtils {
2
+ /**
3
+ * @description Create Element node
4
+ * @param elementName Element name
5
+ * @param attributes The attributes of the tag. {style: "font-size:12px;..", class: "el_class",..}
6
+ * @param {string|Element|null|undefined} inner A innerHTML or inner element.
7
+ * @returns
8
+ */
9
+ createElement(elementName: string, attributes?: Record<string, string> | null, inner?: string | Element | null): Element;
10
+
11
+ /**
12
+ * @description Create text node
13
+ * @param text text content
14
+ * @returns
15
+ */
16
+ createTextNode(text: string): Node;
17
+
18
+ /**
19
+ * @description Get the argument iframe's document object
20
+ * @param iframe Iframe element (this.editor.frameContext('wysiwygFrame'))
21
+ * @returns
22
+ */
23
+ getIframeDocument(iframe: Element): Document;
24
+
25
+ /**
26
+ * @description Get attributes of argument element to string ('class="---" name="---" ')
27
+ * @param element Element object
28
+ * @param exceptAttrs Array of attribute names to exclude from the result
29
+ * @returns
30
+ */
31
+ getAttributesToString(element: Element, exceptAttrs?: string[]): string;
32
+
33
+ /**
34
+ * @description Returns the index compared to other sibling nodes.
35
+ * @param node The Node to find index
36
+ * @returns
37
+ */
38
+ getPositionIndex(node: Node): number;
39
+
40
+ /**
41
+ * @description Returns the position of the "node" in the "parentNode" in a numerical array.
42
+ * ex) <p><span>aa</span><span>bb</span></p> : getNodePath(node: "bb", parentNode: "<P>") -> [1, 0]
43
+ * @param node The Node to find position path
44
+ * @param parentNode Parent node. If null, wysiwyg div area
45
+ * @param _newOffsets If you send an object of the form "{s: 0, e: 0}", the text nodes that are attached together are merged into one, centered on the "node" argument.
46
+ * "_newOffsets.s" stores the length of the combined characters after "node" and "_newOffsets.e" stores the length of the combined characters before "node".
47
+ * Do not use unless absolutely necessary.
48
+ * @returns
49
+ */
50
+ getNodePath(node: Node, parentNode?: Node, _newOffsets?: { s: number; e: number }): number[];
51
+
52
+ /**
53
+ * @description Returns the node in the location of the path array obtained from "util.getNodePath".
54
+ * @param offsets Position array, array obtained from "util.getNodePath"
55
+ * @param parentNode Base parent element
56
+ * @returns
57
+ */
58
+ getNodeFromPath(offsets: number[], parentNode: Node): Node;
59
+
60
+ /**
61
+ * @description Get all "children" of the argument value element (Without text nodes)
62
+ * @param element element to get child node
63
+ * @param validation Conditional function
64
+ * @returns
65
+ */
66
+ getListChildren(element: Element, validation?: Function): Element[];
67
+
68
+ /**
69
+ * @description Get all "childNodes" of the argument value element (Include text nodes)
70
+ * @param element element to get child node
71
+ * @param validation Conditional function
72
+ * @returns
73
+ */
74
+ getListChildNodes(element: Node, validation?: Function): Node[];
75
+
76
+ /**
77
+ * @description Returns the number of parents nodes.
78
+ * "0" when the parent node is the WYSIWYG area.
79
+ * "-1" when the element argument is the WYSIWYG area.
80
+ * @param element The element to check
81
+ * @returns
82
+ */
83
+ getNodeDepth(element: Node): number;
84
+
85
+ /**
86
+ * @description Sort a element array by depth of element.
87
+ * @param array Array object
88
+ * @param des true: descending order / false: ascending order
89
+ */
90
+ sortNodeByDepth(array: Node[], des: boolean): void;
91
+
92
+ /**
93
+ * @description Compares two elements to find a common ancestor, and returns the order of the two elements.
94
+ * @param a Node to compare.
95
+ * @param b Node to compare.
96
+ * @returns
97
+ */
98
+ compareElements(a: Node, b: Node): { ancestor: Element | null; a: Node; b: Node; result: number };
99
+
100
+ /**
101
+ * @description Get the parent element of the argument value.
102
+ * A tag that satisfies the query condition is imported.
103
+ * Returns null if not found.
104
+ * @param element Reference element
105
+ * @param query Query String (nodeName, .className, #ID, :name) or validation function.
106
+ * Not use it like jquery.
107
+ * Only one condition can be entered at a time.
108
+ * @returns
109
+ */
110
+ getParentElement(element: Node, query: string | Function): Element;
111
+
112
+ /**
113
+ * @description Get the child element of the argument value.
114
+ * A tag that satisfies the query condition is imported.
115
+ * Returns null if not found.
116
+ * @param element Reference element
117
+ * @param query Query String (nodeName, .className, #ID, :name) or validation function.
118
+ * @param last If true returns the last node among the found child nodes. (default: first node)
119
+ * Not use it like jquery.
120
+ * Only one condition can be entered at a time.
121
+ * @returns
122
+ */
123
+ getEdgeChild(element: Node, query: string | Function, last: boolean): Element;
124
+
125
+ /**
126
+ * @description 1. The first node of all the child nodes of the "first" element is returned.
127
+ * 2. The last node of all the child nodes of the "last" element is returned.
128
+ * 3. When there is no "last" element, the first and last nodes of all the children of the "first" element are returned.
129
+ * { sc: "first", ec: "last" }
130
+ * @param first First element
131
+ * @param last Last element
132
+ * @returns
133
+ */
134
+ getEdgeChildNodes(first: Node, last?: Node): { sc: Node; ec: Node | null };
135
+
136
+ /**
137
+ * @description Get the item from the array that matches the condition.
138
+ * @param array Array to get item
139
+ * @param validation Conditional function
140
+ * @param multi If true, returns all items that meet the criteria otherwise, returns an empty array.
141
+ * If false, returns only one item that meet the criteria otherwise return null.
142
+ * @returns
143
+ */
144
+ getArrayItem(array: any[] | HTMLCollection | NodeList, validation: Function | null, multi: boolean): any[] | Node | null;
145
+
146
+ /**
147
+ * @description Check if an array contains an element
148
+ * @param {Array|HTMLCollection|NodeList} array element array
149
+ * @param {Node} element The element to check for
150
+ * @returns {Boolean}
151
+ */
152
+ arrayIncludes(array: any[], element: Node): boolean;
153
+
154
+ /**
155
+ * @description Get the index of the argument value in the element array
156
+ * @param array element array
157
+ * @param element The element to find index
158
+ * @returns
159
+ */
160
+ getArrayIndex(array: any[] | HTMLCollection | NodeList, element: Node): number;
161
+
162
+ /**
163
+ * @description Get the next index of the argument value in the element array
164
+ * @param array element array
165
+ * @param item The element to find index
166
+ * @returns
167
+ */
168
+ nextIndex(array: any[] | HTMLCollection | NodeList, item: Node): number;
169
+
170
+ /**
171
+ * @description Add style and className of copyEl to originEl
172
+ * @param originEl Origin element
173
+ * @param copyEl Element to copy
174
+ */
175
+ copyTagAttributes(originEl: Element, copyEl: Element): void;
176
+
177
+ /**
178
+ * @description Copy and apply attributes of format tag that should be maintained. (style, class) Ignore "__se__format__" class
179
+ * @param originEl Origin element
180
+ * @param copyEl Element to copy
181
+ */
182
+ copyFormatAttributes(originEl: Element, copyEl: Element): void;
183
+
184
+ /**
185
+ * @description Compares the style and class for equal values.
186
+ * Returns true if both are text nodes.
187
+ * @param a Node to compare
188
+ * @param b Node to compare
189
+ * @returns
190
+ */
191
+ isSameAttributes(a: Node, b: Node): boolean;
192
+
193
+ /**
194
+ * @description Delete argumenu value element
195
+ * @param item Node to be remove
196
+ */
197
+ removeItem(item: Node): void;
198
+
199
+ /**
200
+ * @description Replace icon
201
+ * @param element Target element
202
+ * @param newElement String or element of the new element to apply
203
+ */
204
+ changeElement(element: Element, newElement: string | Element): void;
205
+
206
+ /**
207
+ * @description Set the text content value of the argument value element
208
+ * @param element Element to replace text content
209
+ * @param txt Text to be applied
210
+ */
211
+ changeTxt(element: Node, txt: string): void;
212
+
213
+ /**
214
+ * @description Set style, if all styles are deleted, the style properties are deleted.
215
+ * @param element Element to set style
216
+ * @param styleName Style attribute name (marginLeft, textAlign...)
217
+ * @param value Style value
218
+ */
219
+ setStyle(element: Element, styleName: string, value: string | number): void;
220
+
221
+ /**
222
+ * @description In the predefined code view mode, the buttons except the executable button are changed to the 'disabled' state.
223
+ * @param buttonList Button array
224
+ * @param disabled Disabled value
225
+ */
226
+ setDisabled(buttonList: Element[] | HTMLCollection | NodeList, disabled: boolean): void;
227
+
228
+ /**
229
+ * @description Determine whether any of the matched elements are assigned the given class
230
+ * @param element Elements to search class name
231
+ * @param className Class name to search for
232
+ * @returns
233
+ */
234
+ hasClass(element: Element, className: string): boolean;
235
+
236
+ /**
237
+ * @description Append the className value of the argument value element
238
+ * @param element Elements to add class name
239
+ * @param className Class name to be add
240
+ */
241
+ addClass(element: Element, className: string): void;
242
+
243
+ /**
244
+ * @description Delete the className value of the argument value element
245
+ * @param element Elements to remove class name
246
+ * @param className Class name to be remove
247
+ */
248
+ removeClass(element: Element, className: string): void;
249
+
250
+ /**
251
+ * @description Argument value If there is no class name, insert it and delete the class name if it exists
252
+ * @param element Elements to replace class name
253
+ * @param className Class name to be change
254
+ * @returns
255
+ */
256
+ toggleClass(element: Element, className: string): boolean | undefined;
257
+
258
+ /**
259
+ * @description Get the previous index of the argument value in the element array
260
+ * @param array Element array
261
+ * @param item The element to find index
262
+ * @returns
263
+ */
264
+ prevIndex(array: any[] | HTMLCollection | NodeList, item: Node): number;
265
+
266
+ /**
267
+ * @description Determine if this offset is the edge offset of container
268
+ * @param container The container property of the selection object.
269
+ * @param offset The offset property of the selection object.
270
+ * @param dir Select check point - Both edge, Front edge or End edge. ("front": Front edge, "end": End edge, undefined: Both edge)
271
+ * @returns
272
+ */
273
+ isEdgePoint(container: Node, offset: number, dir?: 'front' | 'end'): boolean;
274
+
275
+ /**
276
+ * @description It is judged whether it is the edit region top div element or iframe's body tag.
277
+ * @param element The node to check
278
+ * @returns
279
+ */
280
+ isWysiwygFrame(element: Node): boolean;
281
+
282
+ /**
283
+ * @description It is judged whether it is the contenteditable property is false.
284
+ * @param element The node to check
285
+ * @returns
286
+ */
287
+ isNonEditable(element: Node): boolean;
288
+
289
+ /**
290
+ * @description Check the node is a list (ol, ul)
291
+ * @param node The element or element name to check
292
+ * @returns
293
+ */
294
+ isList(node: string | Node): boolean;
295
+
296
+ /**
297
+ * @description Check the node is a list cell (li)
298
+ * @param node The element or element name to check
299
+ * @returns
300
+ */
301
+ isListCell(node: string | Node): boolean;
302
+
303
+ /**
304
+ * @description Check the node is a table
305
+ * @param node The element or element name to check
306
+ * @returns
307
+ */
308
+ isTable(node: string | Node): boolean;
309
+
310
+ /**
311
+ * @description Check the node is a table elements. (table, thead, tbody, tr, th, td)
312
+ * @param node The element or element name to check
313
+ * @returns
314
+ */
315
+ isTableElements(node: string | Node): boolean;
316
+
317
+ /**
318
+ * @description Check the node is a table cell (td, th)
319
+ * @param node The element or element name to check
320
+ * @returns
321
+ */
322
+ isTableCell(node: string | Node): boolean;
323
+
324
+ /**
325
+ * @description Check the node is a break node (BR)
326
+ * @param node The element or element name to check
327
+ * @returns
328
+ */
329
+ isBreak(node: string | Node): boolean;
330
+
331
+ /**
332
+ * @description Check the node is a anchor node (A)
333
+ * @param node The element or element name to check
334
+ * @returns
335
+ */
336
+ isAnchor(node: string | Node): boolean;
337
+
338
+ /**
339
+ * @description Check the node is a media node (img, iframe, audio, video, canvas)
340
+ * @param node The element or element name to check
341
+ * @returns
342
+ */
343
+ isMedia(node: string | Node): boolean;
344
+
345
+ /**
346
+ * @description Check the line element is empty.
347
+ * @param {Element} element Format element node
348
+ * @returns {boolean}
349
+ */
350
+ isEmptyLine(element: Element): boolean;
351
+
352
+ /**
353
+ * @description Checks for "__se__uneditable" in the class list.
354
+ * Components with class "__se__uneditable" cannot be modified.
355
+ * @param element The node to check
356
+ * @returns
357
+ */
358
+ isUneditable(element: Element): boolean;
359
+ }
360
+
361
+ export default domUtils;
@@ -0,0 +1,7 @@
1
+ import CoreInterface from './_core';
2
+ import ClassInterface from '../src/interface/_module';
3
+
4
+ class Editor implements CoreInterface, ClassInterface {}
5
+
6
+ export default Editor;
7
+ s;