suneditor 2.44.3 → 2.44.4

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 (131) hide show
  1. package/LICENSE.txt +20 -20
  2. package/README.md +1585 -1585
  3. package/dist/css/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +2 -2
  5. package/package.json +71 -71
  6. package/src/assets/css/suneditor-contents.css +556 -556
  7. package/src/assets/css/suneditor.css +0 -0
  8. package/src/assets/defaultIcons.js +103 -103
  9. package/src/lang/Lang.d.ts +143 -143
  10. package/src/lang/ckb.d.ts +4 -4
  11. package/src/lang/ckb.js +187 -187
  12. package/src/lang/da.d.ts +4 -4
  13. package/src/lang/da.js +191 -191
  14. package/src/lang/de.d.ts +4 -4
  15. package/src/lang/de.js +187 -187
  16. package/src/lang/en.d.ts +4 -4
  17. package/src/lang/en.js +187 -187
  18. package/src/lang/es.d.ts +4 -4
  19. package/src/lang/es.js +187 -187
  20. package/src/lang/fr.d.ts +4 -4
  21. package/src/lang/fr.js +188 -188
  22. package/src/lang/he.d.ts +4 -4
  23. package/src/lang/he.js +188 -188
  24. package/src/lang/index.d.ts +22 -21
  25. package/src/lang/index.js +25 -24
  26. package/src/lang/it.d.ts +4 -4
  27. package/src/lang/it.js +188 -188
  28. package/src/lang/ja.d.ts +4 -4
  29. package/src/lang/ja.js +187 -187
  30. package/src/lang/ko.d.ts +4 -4
  31. package/src/lang/ko.js +187 -187
  32. package/src/lang/lv.d.ts +4 -4
  33. package/src/lang/lv.js +187 -187
  34. package/src/lang/nl.d.ts +4 -4
  35. package/src/lang/nl.js +187 -187
  36. package/src/lang/pl.d.ts +4 -4
  37. package/src/lang/pl.js +187 -187
  38. package/src/lang/pt_br.d.ts +4 -4
  39. package/src/lang/pt_br.js +189 -189
  40. package/src/lang/ro.d.ts +4 -4
  41. package/src/lang/ro.js +187 -187
  42. package/src/lang/ru.d.ts +4 -4
  43. package/src/lang/ru.js +187 -187
  44. package/src/lang/se.d.ts +4 -4
  45. package/src/lang/se.js +191 -191
  46. package/src/lang/ua.d.ts +5 -5
  47. package/src/lang/ua.js +188 -188
  48. package/src/lang/ur.d.ts +5 -0
  49. package/src/lang/ur.js +188 -0
  50. package/src/lang/zh_cn.d.ts +4 -4
  51. package/src/lang/zh_cn.js +187 -187
  52. package/src/lib/constructor.js +1 -2
  53. package/src/lib/context.d.ts +42 -42
  54. package/src/lib/context.js +0 -0
  55. package/src/lib/core.d.ts +1101 -1101
  56. package/src/lib/core.js +205 -88
  57. package/src/lib/history.d.ts +48 -48
  58. package/src/lib/history.js +218 -218
  59. package/src/lib/util.d.ts +677 -677
  60. package/src/lib/util.js +38 -12
  61. package/src/options.d.ts +608 -608
  62. package/src/plugins/CommandPlugin.d.ts +7 -7
  63. package/src/plugins/DialogPlugin.d.ts +19 -19
  64. package/src/plugins/FileBrowserPlugin.d.ts +29 -29
  65. package/src/plugins/Module.d.ts +14 -14
  66. package/src/plugins/Plugin.d.ts +41 -41
  67. package/src/plugins/SubmenuPlugin.d.ts +7 -7
  68. package/src/plugins/command/blockquote.d.ts +4 -4
  69. package/src/plugins/command/blockquote.js +46 -46
  70. package/src/plugins/dialog/audio.d.ts +4 -4
  71. package/src/plugins/dialog/audio.js +556 -554
  72. package/src/plugins/dialog/image.d.ts +4 -4
  73. package/src/plugins/dialog/image.js +1122 -1107
  74. package/src/plugins/dialog/link.d.ts +4 -4
  75. package/src/plugins/dialog/link.js +223 -223
  76. package/src/plugins/dialog/math.d.ts +4 -4
  77. package/src/plugins/dialog/math.js +294 -294
  78. package/src/plugins/dialog/mention.d.ts +5 -5
  79. package/src/plugins/dialog/mention.js +242 -242
  80. package/src/plugins/dialog/video.d.ts +4 -4
  81. package/src/plugins/dialog/video.js +983 -981
  82. package/src/plugins/fileBrowser/imageGallery.d.ts +4 -4
  83. package/src/plugins/fileBrowser/imageGallery.js +63 -63
  84. package/src/plugins/index.d.ts +79 -79
  85. package/src/plugins/index.js +32 -32
  86. package/src/plugins/modules/_anchor.js +461 -462
  87. package/src/plugins/modules/_colorPicker.d.ts +59 -59
  88. package/src/plugins/modules/_colorPicker.js +0 -0
  89. package/src/plugins/modules/_notice.d.ts +20 -20
  90. package/src/plugins/modules/_notice.js +72 -72
  91. package/src/plugins/modules/_selectMenu.js +118 -118
  92. package/src/plugins/modules/component.d.ts +24 -24
  93. package/src/plugins/modules/component.js +82 -82
  94. package/src/plugins/modules/dialog.d.ts +27 -27
  95. package/src/plugins/modules/dialog.js +174 -174
  96. package/src/plugins/modules/fileBrowser.d.ts +41 -41
  97. package/src/plugins/modules/fileBrowser.js +373 -373
  98. package/src/plugins/modules/fileManager.d.ts +66 -66
  99. package/src/plugins/modules/fileManager.js +325 -324
  100. package/src/plugins/modules/index.d.ts +10 -10
  101. package/src/plugins/modules/index.js +8 -8
  102. package/src/plugins/modules/resizing.d.ts +153 -153
  103. package/src/plugins/modules/resizing.js +895 -895
  104. package/src/plugins/submenu/align.d.ts +4 -4
  105. package/src/plugins/submenu/align.js +160 -160
  106. package/src/plugins/submenu/font.d.ts +4 -4
  107. package/src/plugins/submenu/font.js +120 -120
  108. package/src/plugins/submenu/fontColor.d.ts +4 -4
  109. package/src/plugins/submenu/fontColor.js +0 -0
  110. package/src/plugins/submenu/fontSize.d.ts +4 -4
  111. package/src/plugins/submenu/fontSize.js +112 -112
  112. package/src/plugins/submenu/formatBlock.d.ts +4 -4
  113. package/src/plugins/submenu/formatBlock.js +273 -273
  114. package/src/plugins/submenu/hiliteColor.d.ts +4 -4
  115. package/src/plugins/submenu/hiliteColor.js +0 -0
  116. package/src/plugins/submenu/horizontalRule.d.ts +4 -4
  117. package/src/plugins/submenu/horizontalRule.js +98 -98
  118. package/src/plugins/submenu/lineHeight.d.ts +4 -4
  119. package/src/plugins/submenu/lineHeight.js +104 -104
  120. package/src/plugins/submenu/list.d.ts +4 -4
  121. package/src/plugins/submenu/list.js +456 -455
  122. package/src/plugins/submenu/paragraphStyle.d.ts +4 -4
  123. package/src/plugins/submenu/paragraphStyle.js +135 -135
  124. package/src/plugins/submenu/table.d.ts +4 -4
  125. package/src/plugins/submenu/template.d.ts +4 -4
  126. package/src/plugins/submenu/template.js +71 -71
  127. package/src/plugins/submenu/textStyle.d.ts +4 -4
  128. package/src/plugins/submenu/textStyle.js +167 -167
  129. package/src/suneditor.d.ts +9 -9
  130. package/src/suneditor.js +75 -75
  131. package/src/suneditor_build.js +17 -17
package/src/lib/util.d.ts CHANGED
@@ -1,678 +1,678 @@
1
- declare interface util {
2
- isIE: boolean;
3
- isIE_Edge: boolean;
4
- /**
5
- * @description Unicode Character 'ZERO WIDTH SPACE' (\u200B)
6
- */
7
- zeroWidthSpace: string;
8
-
9
- /**
10
- * @description Regular expression to find 'zero width space' (/\u200B/g)
11
- */
12
- zeroWidthRegExp: RegExp;
13
-
14
- /**
15
- * @description Regular expression to find only 'zero width space' (/^\u200B+$/)
16
- */
17
- onlyZeroWidthRegExp: RegExp;
18
-
19
- /**
20
- * @description A method that checks If the text is blank or to see if it contains 'ZERO WIDTH SPACE' or empty (util.zeroWidthSpace)
21
- * @param text String value or Node
22
- * @returns
23
- */
24
- onlyZeroWidthSpace(text: string | Node): boolean;
25
-
26
- /**
27
- * @description Gets XMLHttpRequest object
28
- * @returns
29
- */
30
- getXMLHttpRequest(): XMLHttpRequest | ActiveXObject;
31
-
32
- /**
33
- * @description Object.values
34
- * @param obj Object parameter.
35
- * @returns
36
- */
37
- getValues(obj?: any): any[];
38
-
39
- /**
40
- * @description Convert the CamelCase To the KebabCase.
41
- * @param {String|Array} param [Camel string]
42
- */
43
- camelToKebabCase(param: string | string[]): string | string[],
44
-
45
- /**
46
- * @description Convert the KebabCase To the CamelCase.
47
- * @param {String|Array} param [KebabCase string]
48
- */
49
- kebabToCamelCase(param: string | string[]): string | string[],
50
-
51
- /**
52
- * @description Create Element node
53
- * @param elementName Element name
54
- * @returns
55
- */
56
- createElement(elementName: string): Element;
57
-
58
- /**
59
- * @description Create text node
60
- * @param text text contents
61
- * @returns
62
- */
63
- createTextNode(text: string): Node;
64
-
65
- /**
66
- * @description The editor checks tags by string.
67
- * If there is "<" or ">" in the attribute of tag, HTML is broken when checking the tag.
68
- * When using an attribute with "<" or ">", use "HTMLEncoder" to save. (ex: math(katex))
69
- * @param contents HTML or Text string
70
- * @returns
71
- */
72
- HTMLEncoder(contents: string): string;
73
-
74
- /**
75
- * @description The editor checks tags by string.
76
- * If there is "<" or ">" in the attribute of tag, HTML is broken when checking the tag.
77
- * Decoder of data stored as "HTMLEncoder" (ex: math(katex))
78
- * @param contents HTML or Text string
79
- * @returns
80
- */
81
- HTMLDecoder(contents: string): string;
82
-
83
- /**
84
- * @description This method run Object.prototype.hasOwnProperty.call(obj, key)
85
- * @param obj Object
86
- * @param key obj.key
87
- * @returns
88
- */
89
- hasOwn(obj: any, key: string): boolean;
90
-
91
- /**
92
- * @description Get the the tag path of the arguments value
93
- * If not found, return the first found value
94
- * @param nameArray File name array
95
- * @param extension js, css
96
- * @returns
97
- */
98
- getIncludePath(nameArray: string[], extension: string): string;
99
-
100
- /**
101
- * @description Returns the CSS text that has been applied to the current page.
102
- * @param doc To get the CSS text of an document(core._wd). If null get the current document.
103
- * @returns Styles string
104
- */
105
- getPageStyle(doc?: Document): string;
106
-
107
- /**
108
- * @description Get the argument iframe's document object
109
- * @param iframe Iframe element (context.element.wysiwygFrame)
110
- * @returns
111
- */
112
- getIframeDocument(iframe: Element): Document;
113
-
114
- /**
115
- * @description Get attributes of argument element to string ('class="---" name="---" ')
116
- * @param element Element object
117
- * @param exceptAttrs Array of attribute names to exclude from the result
118
- * @returns
119
- */
120
- getAttributesToString(element: Element, exceptAttrs?: string[]): string;
121
-
122
- /**
123
- * @descriptionGets Get the length in bytes of a string.
124
- * referencing code: "https://github.com/shaan1974/myrdin/blob/master/expressions/string.js#L11"
125
- * @param text String text
126
- * @returns
127
- */
128
- getByteLength(text: string): number;
129
-
130
- /**
131
- * @description It is judged whether it is the edit region top div element or iframe's body tag.
132
- * @param element The node to check
133
- * @returns
134
- */
135
- isWysiwygDiv(element: Node): boolean;
136
-
137
- /**
138
- * @description It is judged whether it is the contenteditable property is false.
139
- * @param element The node to check
140
- * @returns
141
- */
142
- isNonEditable(element: Node): boolean;
143
-
144
- /**
145
- * @description It is judged whether it is a node related to the text style.
146
- * (strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label)
147
- * @param element The node to check
148
- * @returns
149
- */
150
- isTextStyleElement(element: Node): boolean;
151
-
152
- /**
153
- * @description It is judged whether it is the format element (P, DIV, H[1-6], PRE, LI | class="__se__format__replace_xxx")
154
- * Format element also contain "free format Element"
155
- * @param element The node to check
156
- * @returns
157
- */
158
- isFormatElement(element: Node): boolean;
159
-
160
- /**
161
- * @description It is judged whether it is the range format element. (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__range_xxx")
162
- * * Range format element is wrap the format element (util.isFormatElement)
163
- * @param element The node to check
164
- * @returns
165
- */
166
- isRangeFormatElement(element: Node): boolean;
167
-
168
- /**
169
- * @description It is judged whether it is the closure range format element. (TH, TD | class="__se__format__range__closure_xxx")
170
- * Closure range format elements is included in the range format element.
171
- * - Closure range format element is wrap the "format element" and "component"
172
- * ※ You cannot exit this format with the Enter key or Backspace key.
173
- * ※ Use it only in special cases. ([ex] format of table cells)
174
- * @param element The node to check
175
- * @returns
176
- */
177
- isClosureRangeFormatElement(element: Node): boolean;
178
-
179
- /**
180
- * @description It is judged whether it is the free format element. (PRE | class="__se__format__free_xxx")
181
- * Free format elements is included in the format element.
182
- * Free format elements's line break is "BR" tag.
183
- * ※ Entering the Enter key in the space on the last line ends "Free Format" and appends "Format".
184
- * @param element The node to check
185
- * @returns
186
- */
187
- isFreeFormatElement(element: Node): boolean;
188
-
189
- /**
190
- * @description It is judged whether it is the closure free format element. (class="__se__format__free__closure_xxx")
191
- * Closure free format elements is included in the free format element.
192
- * - Closure free format elements's line break is "BR" tag.
193
- * ※ You cannot exit this format with the Enter key.
194
- * ※ Use it only in special cases. ([ex] format of table cells)
195
- * @param element The node to check
196
- * @returns
197
- */
198
- isClosureFreeFormatElement(element: Node): boolean;
199
-
200
- /**
201
- * @description It is judged whether it is the component [img, iframe, video, audio] cover(class="se-component") and table, hr
202
- * @param element The node to check
203
- * @returns
204
- */
205
- isComponent(element: Node): boolean;
206
-
207
- /**
208
- * @description Checks for "__se__uneditable" in the class list.
209
- * Components with class "__se__uneditable" cannot be modified.
210
- * @param element The node to check
211
- * @returns
212
- */
213
- isUneditableComponent(element: Element): boolean;
214
-
215
- /**
216
- * @description It is judged whether it is the not checking node. (class="katex", "__se__tag")
217
- * @param element The node to check
218
- * @returns
219
- */
220
- isMediaComponent(element: Node): boolean;
221
-
222
- /**
223
- * @description It is judged whether it is the component [img, iframe] cover(class="se-component")
224
- * @param element The node to check
225
- * @returns
226
- */
227
- isNotCheckingNode(element: Node): boolean;
228
-
229
- /**
230
- * @description If a parent node that contains an argument node finds a format node (util.isFormatElement), it returns that node.
231
- * @param element Reference node.
232
- * @param validation Additional validation function.
233
- * @returns
234
- */
235
- getFormatElement(element: Node, validation?: Function): Element | null;
236
-
237
- /**
238
- * @description If a parent node that contains an argument node finds a format node (util.isRangeFormatElement), it returns that node.
239
- * @param element Reference node.
240
- * @param validation Additional validation function.
241
- * @returns
242
- */
243
- getRangeFormatElement(element: Node, validation?: Function): Element | null;
244
-
245
- /**
246
- * @description If a parent node that contains an argument node finds a free format node (util.isFreeFormatElement), it returns that node.
247
- * @param element Reference node.
248
- * @param validation Additional validation function.
249
- * @returns
250
- */
251
- getFreeFormatElement(element: Node, validation?: Function): Element | null;
252
-
253
- /**
254
- * @description If a parent node that contains an argument node finds a closure free format node (util.isClosureFreeFormatElement), it returns that node.
255
- * @param element Reference node.
256
- * @param validation Additional validation function.
257
- * @returns
258
- */
259
- getClosureFreeFormatElement(element: Node, validation?: Function): Element | null;
260
-
261
- /**
262
- * @description Add style and className of copyEl to originEl
263
- * @param originEl Origin element
264
- * @param copyEl Element to copy
265
- */
266
- copyTagAttributes(originEl: Element, copyEl: Element): void;
267
-
268
- /**
269
- * @description Copy and apply attributes of format tag that should be maintained. (style, class) Ignore "__se__format__" class
270
- * @param originEl Origin element
271
- * @param copyEl Element to copy
272
- */
273
- copyFormatAttributes(originEl: Element, copyEl: Element): void;
274
-
275
- /**
276
- * @description Get the item from the array that matches the condition.
277
- * @param array Array to get item
278
- * @param validation Conditional function
279
- * @param multi If true, returns all items that meet the criteria otherwise, returns an empty array.
280
- * If false, returns only one item that meet the criteria otherwise return null.
281
- * @returns
282
- */
283
- getArrayItem(array: any[] | HTMLCollection | NodeList, validation: Function | null, multi: boolean): any[] | Node | null;
284
-
285
- /**
286
- * @description Check if an array contains an element
287
- * @param {Array|HTMLCollection|NodeList} array element array
288
- * @param {Node} element The element to find index
289
- * @returns {Boolean}
290
- */
291
- arrayIncludes(array: any[] | HTMLCollection | NodeList, element: Node): boolean;
292
-
293
- /**
294
- * @description Get the index of the argument value in the element array
295
- * @param array element array
296
- * @param element The element to find index
297
- * @returns
298
- */
299
- getArrayIndex(array: any[] | HTMLCollection | NodeList, element: Node): number;
300
-
301
- /**
302
- * @description Get the next index of the argument value in the element array
303
- * @param array element array
304
- * @param item The element to find index
305
- * @returns
306
- */
307
- nextIdx(array: any[] | HTMLCollection | NodeList, item: Node): number;
308
-
309
- /**
310
- * @description Get the previous index of the argument value in the element array
311
- * @param array Element array
312
- * @param item The element to find index
313
- * @returns
314
- */
315
- prevIdx(array: any[] | HTMLCollection | NodeList, item: Node): number;
316
-
317
- /**
318
- * @description Returns the index compared to other sibling nodes.
319
- * @param node The Node to find index
320
- * @returns
321
- */
322
- getPositionIndex(node: Node): number;
323
-
324
- /**
325
- * @description Returns the position of the "node" in the "parentNode" in a numerical array.
326
- * ex) <p><span>aa</span><span>bb</span></p> : getNodePath(node: "bb", parentNode: "<P>") -> [1, 0]
327
- * @param node The Node to find position path
328
- * @param parentNode Parent node. If null, wysiwyg div area
329
- * @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.
330
- * "_newOffsets.s" stores the length of the combined characters after "node" and "_newOffsets.e" stores the length of the combined characters before "node".
331
- * Do not use unless absolutely necessary.
332
- * @returns
333
- */
334
- getNodePath(node: Node, parentNode?: Node, _newOffsets?: { s: number; e: number; }): number[];
335
-
336
- /**
337
- * @description Returns the node in the location of the path array obtained from "util.getNodePath".
338
- * @param offsets Position array, array obtained from "util.getNodePath"
339
- * @param parentNode Base parent element
340
- * @returns
341
- */
342
- getNodeFromPath(offsets: number[], parentNode: Node): Node;
343
-
344
- /**
345
- * @description Compares the style and class for equal values.
346
- * Returns true if both are text nodes.
347
- * @param a Node to compare
348
- * @param b Node to compare
349
- * @returns
350
- */
351
- isSameAttributes(a: Node, b: Node): boolean;
352
-
353
- /**
354
- * @description Check the line element(util.isFormatElement) is empty.
355
- * @param {Element} element Format element node
356
- * @returns {Boolean}
357
- */
358
- isEmptyLine(element: Element): boolean;
359
-
360
- /**
361
- * @description Check the span's attributes are empty.
362
- * @param {Element} element Element node
363
- * @returns {Boolean}
364
- */
365
- isSpanWithoutAttr(element: Element|null): boolean;
366
-
367
- /**
368
- * @description Check the node is a list (ol, ul)
369
- * @param node The element or element name to check
370
- * @returns
371
- */
372
- isList(node: string | Node): boolean;
373
-
374
- /**
375
- * @description Check the node is a list cell (li)
376
- * @param node The element or element name to check
377
- * @returns
378
- */
379
- isListCell(node: string | Node): boolean;
380
-
381
- /**
382
- * @description Check the node is a table (table, thead, tbody, tr, th, td)
383
- * @param node The element or element name to check
384
- * @returns
385
- */
386
- isTable(node: string | Node): boolean;
387
-
388
- /**
389
- * @description Check the node is a table cell (td, th)
390
- * @param node The element or element name to check
391
- * @returns
392
- */
393
- isCell(node: string | Node): boolean;
394
-
395
- /**
396
- * @description Check the node is a break node (BR)
397
- * @param node The element or element name to check
398
- * @returns
399
- */
400
- isBreak(node: string | Node): boolean;
401
-
402
- /**
403
- * @description Check the node is a anchor node (A)
404
- * @param node The element or element name to check
405
- * @returns
406
- */
407
- isAnchor(node: string | Node): boolean;
408
-
409
- /**
410
- * @description Check the node is a media node (img, iframe, audio, video, canvas)
411
- * @param node The element or element name to check
412
- * @returns
413
- */
414
- isMedia(node: string | Node): boolean;
415
-
416
- /**
417
- * @description Checks for numeric (with decimal point).
418
- * @param text Text string or number
419
- * @returns
420
- */
421
- isNumber(text: string | number): boolean;
422
-
423
- /**
424
- * @description Get a number.
425
- * @param text Text string or number
426
- * @param maxDec Maximum number of decimal places (-1 : Infinity)
427
- * @returns
428
- */
429
- getNumber(text: string | number, maxDec: number): number;
430
-
431
- /**
432
- * @description Get all "children" of the argument value element (Without text nodes)
433
- * @param element element to get child node
434
- * @param validation Conditional function
435
- * @returns
436
- */
437
- getListChildren(element: Element, validation?: Function): Element[];
438
-
439
- /**
440
- * @description Get all "childNodes" of the argument value element (Include text nodes)
441
- * @param element element to get child node
442
- * @param validation Conditional function
443
- * @returns
444
- */
445
- getListChildNodes(element: Node, validation?: Function): Node[];
446
-
447
- /**
448
- * @description Returns the number of parents nodes.
449
- * "0" when the parent node is the WYSIWYG area.
450
- * "-1" when the element argument is the WYSIWYG area.
451
- * @param element The element to check
452
- * @returns
453
- */
454
- getElementDepth(element: Node): number;
455
-
456
- /**
457
- * @description Compares two elements to find a common ancestor, and returns the order of the two elements.
458
- * @param a Node to compare.
459
- * @param b Node to compare.
460
- * @returns
461
- */
462
- compareElements(a: Node, b: Node): {ancestor: Element | null, a: Node, b: Node, result: number};
463
-
464
- /**
465
- * @description Get the parent element of the argument value.
466
- * A tag that satisfies the query condition is imported.
467
- * Returns null if not found.
468
- * @param element Reference element
469
- * @param query Query String (nodeName, .className, #ID, :name) or validation function.
470
- * Not use it like jquery.
471
- * Only one condition can be entered at a time.
472
- * @returns
473
- */
474
- getParentElement(element: Node, query: string | Function): Element;
475
-
476
- /**
477
- * @description Get the child element of the argument value.
478
- * A tag that satisfies the query condition is imported.
479
- * Returns null if not found.
480
- * @param element Reference element
481
- * @param query Query String (nodeName, .className, #ID, :name) or validation function.
482
- * @param last If true returns the last node among the found child nodes. (default: first node)
483
- * Not use it like jquery.
484
- * Only one condition can be entered at a time.
485
- * @returns
486
- */
487
- getChildElement(element: Node, query: string | Function, last: boolean): Element;
488
-
489
- /**
490
- * @description 1. The first node of all the child nodes of the "first" element is returned.
491
- * 2. The last node of all the child nodes of the "last" element is returned.
492
- * 3. When there is no "last" element, the first and last nodes of all the children of the "first" element are returned.
493
- * { sc: "first", ec: "last" }
494
- * @param first First element
495
- * @param last Last element
496
- * @returns
497
- */
498
- getEdgeChildNodes(first: Node, last?: Node): {sc: Node; ec: Node | null;};
499
-
500
- /**
501
- * @description Returns the position of the left and top of argument. {left:0, top:0}
502
- * @param element Target node
503
- * @param wysiwygFrame When use iframe option, iframe object should be sent (context.element.wysiwygFrame)
504
- * @returns
505
- */
506
- getOffset(element: Node, wysiwygFrame?: Element): Record<string, number>;
507
-
508
- /**
509
- * @description It compares the start and end indexes of "a" and "b" and returns the number of overlapping indexes in the range.
510
- * ex) 1, 5, 4, 6 => "2" (4 ~ 5)
511
- * @param aStart Start index of "a"
512
- * @param aEnd End index of "a"
513
- * @param bStart Start index of "b"
514
- * @param bEnd Start index of "b"
515
- * @returns
516
- */
517
- getOverlapRangeAtIndex(aStart: number, aEnd: number, bStart: number, bEnd: number): number;
518
-
519
- /**
520
- * @description Set the text content value of the argument value element
521
- * @param element Element to replace text content
522
- * @param txt Text to be applied
523
- */
524
- changeTxt(element: Node, txt: string): void;
525
-
526
- /**
527
- * @description Replace icon
528
- * @param element Target element
529
- * @param newElement String or element of the new element to apply
530
- */
531
- changeElement(icon: Element, newIcon: string | Element): void;
532
-
533
- /**
534
- * @description Set style, if all styles are deleted, the style properties are deleted.
535
- * @param element Element to set style
536
- * @param styleName Style attribute name (marginLeft, textAlign...)
537
- * @param value Style value
538
- */
539
- setStyle(element: Element, styleName: string, value: string | number): void;
540
-
541
- /**
542
- * @description Determine whether any of the matched elements are assigned the given class
543
- * @param element Elements to search class name
544
- * @param className Class name to search for
545
- * @returns
546
- */
547
- hasClass(element: Element, className: string): boolean;
548
-
549
- /**
550
- * @description Append the className value of the argument value element
551
- * @param element Elements to add class name
552
- * @param className Class name to be add
553
- */
554
- addClass(element: Element, className: string): void;
555
-
556
- /**
557
- * @description Delete the className value of the argument value element
558
- * @param element Elements to remove class name
559
- * @param className Class name to be remove
560
- */
561
- removeClass(element: Element, className: string): void;
562
-
563
- /**
564
- * @description Argument value If there is no class name, insert it and delete the class name if it exists
565
- * @param element Elements to replace class name
566
- * @param className Class name to be change
567
- * @returns
568
- */
569
- toggleClass(element: Element, className: string): boolean | undefined;
570
-
571
- /**
572
- * @description Checks if element can't be easily enabled
573
- * @param {Element} element Element to check for
574
- */
575
- isImportantDisabled(element: Element): boolean;
576
-
577
- /**
578
- * @description In the predefined code view mode, the buttons except the executable button are changed to the 'disabled' state.
579
- * core.codeViewDisabledButtons (An array of buttons whose class name is not "se-code-view-enabled")
580
- * core.resizingDisabledButtons (An array of buttons whose class name is not "se-resizing-enabled")
581
- * @param disabled Disabled value
582
- * @param buttonList Button array
583
- * @param important If priveleged mode should be used (Necessary to switch importantDisabled buttons)
584
- */
585
- setDisabledButtons(disabled: boolean, buttonList: Element[] | HTMLCollection | NodeList, important: Boolean): void;
586
-
587
- /**
588
- * @description Delete argumenu value element
589
- * @param item Node to be remove
590
- */
591
- removeItem(item: Node): void;
592
-
593
- /**
594
- * @description Delete all parent nodes that match the condition.
595
- * Returns an {sc: previousSibling, ec: nextSibling}(the deleted node reference) or null.
596
- * @param item Node to be remove
597
- * @param validation Validation function. default(Deleted if it only have breakLine and blanks)
598
- * @param stopParent Stop when the parent node reaches stopParent
599
- * @returns
600
- */
601
- removeItemAllParents(item: Node, validation?: Function, stopParent?: Element): Record<string, Node | null> | null;
602
-
603
- /**
604
- * @description Detach Nested all nested lists under the "baseNode".
605
- * Returns a list with nested removed.
606
- * @param baseNode Element on which to base.
607
- * @param all If true, it also detach all nested lists of a returned list.
608
- * @returns
609
- */
610
- detachNestedList(baseNode: Node, all: boolean): Element;
611
-
612
- /**
613
- * @description Split all tags based on "baseNode"
614
- * Returns the last element of the splited tag.
615
- * @param baseNode Element or text node on which to base
616
- * @param offset Text offset of "baseNode" (Only valid when "baseNode" is a text node)
617
- * @param depth The nesting depth of the element being split. (default: 0)
618
- * @returns
619
- */
620
- splitElement(baseNode: Node, offset: number | null, depth: number): Element;
621
-
622
- /**
623
- * @description Use with "npdePath (util.getNodePath)" to merge the same attributes and tags if they are present and modify the nodepath.
624
- * If "offset" has been changed, it will return as much "offset" as it has been modified.
625
- * An array containing change offsets is returned in the order of the "nodePathArray" array.
626
- * @param element Element
627
- * @param nodePathArray Array of NodePath object ([util.getNodePath(), ..])
628
- * @param onlyText If true, non-text nodes(!util._isIgnoreNodeChange) like 'span', 'strong'.. are ignored.
629
- * @returns [offset, ..]
630
- */
631
- mergeSameTags(element: Element, nodePathArray: any[], onlyText: boolean): number[];
632
-
633
- /**
634
- * @description Remove nested tags without other child nodes.
635
- * @param element Element object
636
- * @param validation Validation function / String("tag1|tag2..") / If null, all tags are applicable.
637
- */
638
- mergeNestedTags(element: Element, validation?: string | Function): void;
639
-
640
- /**
641
- * @description Delete a empty child node of argument element
642
- * @param element Element node
643
- * @param notRemoveNode Do not remove node
644
- */
645
- removeEmptyNode(element: Element, notRemoveNode?: Node): void;
646
-
647
- /**
648
- * @description Remove whitespace between tags in HTML string.
649
- * @param html HTML string
650
- * @returns
651
- */
652
- htmlRemoveWhiteSpace(html: string): string;
653
-
654
- /**
655
- * @description Sort a element array by depth of element.
656
- * @param array Array object
657
- * @param des true: descending order / false: ascending order
658
- */
659
- sortByDepth(array: Node[], des: boolean): void;
660
-
661
- /**
662
- * @description Create whitelist RegExp object.
663
- * Return RegExp format: new RegExp("<\\/?\\b(?!" + list + ")\\b[^>^<]*+>", "gi")
664
- * @param list Tags list ("br|p|div|pre...")
665
- * @returns
666
- */
667
- createTagsWhitelist(list: string): RegExp;
668
-
669
- /**
670
- * @description Create blacklist RegExp object.
671
- * Return RegExp format: new RegExp("<\\/?\\b(?:" + list + ")\\b[^>^<]*+>", "gi")
672
- * @param list Tags list ("br|p|div|pre...")
673
- * @returns
674
- */
675
- createTagsBlacklist(list: string): RegExp;
676
- }
677
-
1
+ declare interface util {
2
+ isIE: boolean;
3
+ isIE_Edge: boolean;
4
+ /**
5
+ * @description Unicode Character 'ZERO WIDTH SPACE' (\u200B)
6
+ */
7
+ zeroWidthSpace: string;
8
+
9
+ /**
10
+ * @description Regular expression to find 'zero width space' (/\u200B/g)
11
+ */
12
+ zeroWidthRegExp: RegExp;
13
+
14
+ /**
15
+ * @description Regular expression to find only 'zero width space' (/^\u200B+$/)
16
+ */
17
+ onlyZeroWidthRegExp: RegExp;
18
+
19
+ /**
20
+ * @description A method that checks If the text is blank or to see if it contains 'ZERO WIDTH SPACE' or empty (util.zeroWidthSpace)
21
+ * @param text String value or Node
22
+ * @returns
23
+ */
24
+ onlyZeroWidthSpace(text: string | Node): boolean;
25
+
26
+ /**
27
+ * @description Gets XMLHttpRequest object
28
+ * @returns
29
+ */
30
+ getXMLHttpRequest(): XMLHttpRequest | ActiveXObject;
31
+
32
+ /**
33
+ * @description Object.values
34
+ * @param obj Object parameter.
35
+ * @returns
36
+ */
37
+ getValues(obj?: any): any[];
38
+
39
+ /**
40
+ * @description Convert the CamelCase To the KebabCase.
41
+ * @param {String|Array} param [Camel string]
42
+ */
43
+ camelToKebabCase(param: string | string[]): string | string[],
44
+
45
+ /**
46
+ * @description Convert the KebabCase To the CamelCase.
47
+ * @param {String|Array} param [KebabCase string]
48
+ */
49
+ kebabToCamelCase(param: string | string[]): string | string[],
50
+
51
+ /**
52
+ * @description Create Element node
53
+ * @param elementName Element name
54
+ * @returns
55
+ */
56
+ createElement(elementName: string): Element;
57
+
58
+ /**
59
+ * @description Create text node
60
+ * @param text text contents
61
+ * @returns
62
+ */
63
+ createTextNode(text: string): Node;
64
+
65
+ /**
66
+ * @description The editor checks tags by string.
67
+ * If there is "<" or ">" in the attribute of tag, HTML is broken when checking the tag.
68
+ * When using an attribute with "<" or ">", use "HTMLEncoder" to save. (ex: math(katex))
69
+ * @param contents HTML or Text string
70
+ * @returns
71
+ */
72
+ HTMLEncoder(contents: string): string;
73
+
74
+ /**
75
+ * @description The editor checks tags by string.
76
+ * If there is "<" or ">" in the attribute of tag, HTML is broken when checking the tag.
77
+ * Decoder of data stored as "HTMLEncoder" (ex: math(katex))
78
+ * @param contents HTML or Text string
79
+ * @returns
80
+ */
81
+ HTMLDecoder(contents: string): string;
82
+
83
+ /**
84
+ * @description This method run Object.prototype.hasOwnProperty.call(obj, key)
85
+ * @param obj Object
86
+ * @param key obj.key
87
+ * @returns
88
+ */
89
+ hasOwn(obj: any, key: string): boolean;
90
+
91
+ /**
92
+ * @description Get the the tag path of the arguments value
93
+ * If not found, return the first found value
94
+ * @param nameArray File name array
95
+ * @param extension js, css
96
+ * @returns
97
+ */
98
+ getIncludePath(nameArray: string[], extension: string): string;
99
+
100
+ /**
101
+ * @description Returns the CSS text that has been applied to the current page.
102
+ * @param doc To get the CSS text of an document(core._wd). If null get the current document.
103
+ * @returns Styles string
104
+ */
105
+ getPageStyle(doc?: Document): string;
106
+
107
+ /**
108
+ * @description Get the argument iframe's document object
109
+ * @param iframe Iframe element (context.element.wysiwygFrame)
110
+ * @returns
111
+ */
112
+ getIframeDocument(iframe: Element): Document;
113
+
114
+ /**
115
+ * @description Get attributes of argument element to string ('class="---" name="---" ')
116
+ * @param element Element object
117
+ * @param exceptAttrs Array of attribute names to exclude from the result
118
+ * @returns
119
+ */
120
+ getAttributesToString(element: Element, exceptAttrs?: string[]): string;
121
+
122
+ /**
123
+ * @descriptionGets Get the length in bytes of a string.
124
+ * referencing code: "https://github.com/shaan1974/myrdin/blob/master/expressions/string.js#L11"
125
+ * @param text String text
126
+ * @returns
127
+ */
128
+ getByteLength(text: string): number;
129
+
130
+ /**
131
+ * @description It is judged whether it is the edit region top div element or iframe's body tag.
132
+ * @param element The node to check
133
+ * @returns
134
+ */
135
+ isWysiwygDiv(element: Node): boolean;
136
+
137
+ /**
138
+ * @description It is judged whether it is the contenteditable property is false.
139
+ * @param element The node to check
140
+ * @returns
141
+ */
142
+ isNonEditable(element: Node): boolean;
143
+
144
+ /**
145
+ * @description It is judged whether it is a node related to the text style.
146
+ * (strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label)
147
+ * @param element The node to check
148
+ * @returns
149
+ */
150
+ isTextStyleElement(element: Node): boolean;
151
+
152
+ /**
153
+ * @description It is judged whether it is the format element (P, DIV, H[1-6], PRE, LI | class="__se__format__replace_xxx")
154
+ * Format element also contain "free format Element"
155
+ * @param element The node to check
156
+ * @returns
157
+ */
158
+ isFormatElement(element: Node): boolean;
159
+
160
+ /**
161
+ * @description It is judged whether it is the range format element. (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__range_xxx")
162
+ * * Range format element is wrap the format element (util.isFormatElement)
163
+ * @param element The node to check
164
+ * @returns
165
+ */
166
+ isRangeFormatElement(element: Node): boolean;
167
+
168
+ /**
169
+ * @description It is judged whether it is the closure range format element. (TH, TD | class="__se__format__range__closure_xxx")
170
+ * Closure range format elements is included in the range format element.
171
+ * - Closure range format element is wrap the "format element" and "component"
172
+ * ※ You cannot exit this format with the Enter key or Backspace key.
173
+ * ※ Use it only in special cases. ([ex] format of table cells)
174
+ * @param element The node to check
175
+ * @returns
176
+ */
177
+ isClosureRangeFormatElement(element: Node): boolean;
178
+
179
+ /**
180
+ * @description It is judged whether it is the free format element. (PRE | class="__se__format__free_xxx")
181
+ * Free format elements is included in the format element.
182
+ * Free format elements's line break is "BR" tag.
183
+ * ※ Entering the Enter key in the space on the last line ends "Free Format" and appends "Format".
184
+ * @param element The node to check
185
+ * @returns
186
+ */
187
+ isFreeFormatElement(element: Node): boolean;
188
+
189
+ /**
190
+ * @description It is judged whether it is the closure free format element. (class="__se__format__free__closure_xxx")
191
+ * Closure free format elements is included in the free format element.
192
+ * - Closure free format elements's line break is "BR" tag.
193
+ * ※ You cannot exit this format with the Enter key.
194
+ * ※ Use it only in special cases. ([ex] format of table cells)
195
+ * @param element The node to check
196
+ * @returns
197
+ */
198
+ isClosureFreeFormatElement(element: Node): boolean;
199
+
200
+ /**
201
+ * @description It is judged whether it is the component [img, iframe, video, audio] cover(class="se-component") and table, hr
202
+ * @param element The node to check
203
+ * @returns
204
+ */
205
+ isComponent(element: Node): boolean;
206
+
207
+ /**
208
+ * @description Checks for "__se__uneditable" in the class list.
209
+ * Components with class "__se__uneditable" cannot be modified.
210
+ * @param element The node to check
211
+ * @returns
212
+ */
213
+ isUneditableComponent(element: Element): boolean;
214
+
215
+ /**
216
+ * @description It is judged whether it is the not checking node. (class="katex", "__se__tag")
217
+ * @param element The node to check
218
+ * @returns
219
+ */
220
+ isMediaComponent(element: Node): boolean;
221
+
222
+ /**
223
+ * @description It is judged whether it is the component [img, iframe] cover(class="se-component")
224
+ * @param element The node to check
225
+ * @returns
226
+ */
227
+ isNotCheckingNode(element: Node): boolean;
228
+
229
+ /**
230
+ * @description If a parent node that contains an argument node finds a format node (util.isFormatElement), it returns that node.
231
+ * @param element Reference node.
232
+ * @param validation Additional validation function.
233
+ * @returns
234
+ */
235
+ getFormatElement(element: Node, validation?: Function): Element | null;
236
+
237
+ /**
238
+ * @description If a parent node that contains an argument node finds a format node (util.isRangeFormatElement), it returns that node.
239
+ * @param element Reference node.
240
+ * @param validation Additional validation function.
241
+ * @returns
242
+ */
243
+ getRangeFormatElement(element: Node, validation?: Function): Element | null;
244
+
245
+ /**
246
+ * @description If a parent node that contains an argument node finds a free format node (util.isFreeFormatElement), it returns that node.
247
+ * @param element Reference node.
248
+ * @param validation Additional validation function.
249
+ * @returns
250
+ */
251
+ getFreeFormatElement(element: Node, validation?: Function): Element | null;
252
+
253
+ /**
254
+ * @description If a parent node that contains an argument node finds a closure free format node (util.isClosureFreeFormatElement), it returns that node.
255
+ * @param element Reference node.
256
+ * @param validation Additional validation function.
257
+ * @returns
258
+ */
259
+ getClosureFreeFormatElement(element: Node, validation?: Function): Element | null;
260
+
261
+ /**
262
+ * @description Add style and className of copyEl to originEl
263
+ * @param originEl Origin element
264
+ * @param copyEl Element to copy
265
+ */
266
+ copyTagAttributes(originEl: Element, copyEl: Element): void;
267
+
268
+ /**
269
+ * @description Copy and apply attributes of format tag that should be maintained. (style, class) Ignore "__se__format__" class
270
+ * @param originEl Origin element
271
+ * @param copyEl Element to copy
272
+ */
273
+ copyFormatAttributes(originEl: Element, copyEl: Element): void;
274
+
275
+ /**
276
+ * @description Get the item from the array that matches the condition.
277
+ * @param array Array to get item
278
+ * @param validation Conditional function
279
+ * @param multi If true, returns all items that meet the criteria otherwise, returns an empty array.
280
+ * If false, returns only one item that meet the criteria otherwise return null.
281
+ * @returns
282
+ */
283
+ getArrayItem(array: any[] | HTMLCollection | NodeList, validation: Function | null, multi: boolean): any[] | Node | null;
284
+
285
+ /**
286
+ * @description Check if an array contains an element
287
+ * @param {Array|HTMLCollection|NodeList} array element array
288
+ * @param {Node} element The element to find index
289
+ * @returns {Boolean}
290
+ */
291
+ arrayIncludes(array: any[] | HTMLCollection | NodeList, element: Node): boolean;
292
+
293
+ /**
294
+ * @description Get the index of the argument value in the element array
295
+ * @param array element array
296
+ * @param element The element to find index
297
+ * @returns
298
+ */
299
+ getArrayIndex(array: any[] | HTMLCollection | NodeList, element: Node): number;
300
+
301
+ /**
302
+ * @description Get the next index of the argument value in the element array
303
+ * @param array element array
304
+ * @param item The element to find index
305
+ * @returns
306
+ */
307
+ nextIdx(array: any[] | HTMLCollection | NodeList, item: Node): number;
308
+
309
+ /**
310
+ * @description Get the previous index of the argument value in the element array
311
+ * @param array Element array
312
+ * @param item The element to find index
313
+ * @returns
314
+ */
315
+ prevIdx(array: any[] | HTMLCollection | NodeList, item: Node): number;
316
+
317
+ /**
318
+ * @description Returns the index compared to other sibling nodes.
319
+ * @param node The Node to find index
320
+ * @returns
321
+ */
322
+ getPositionIndex(node: Node): number;
323
+
324
+ /**
325
+ * @description Returns the position of the "node" in the "parentNode" in a numerical array.
326
+ * ex) <p><span>aa</span><span>bb</span></p> : getNodePath(node: "bb", parentNode: "<P>") -> [1, 0]
327
+ * @param node The Node to find position path
328
+ * @param parentNode Parent node. If null, wysiwyg div area
329
+ * @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.
330
+ * "_newOffsets.s" stores the length of the combined characters after "node" and "_newOffsets.e" stores the length of the combined characters before "node".
331
+ * Do not use unless absolutely necessary.
332
+ * @returns
333
+ */
334
+ getNodePath(node: Node, parentNode?: Node, _newOffsets?: { s: number; e: number; }): number[];
335
+
336
+ /**
337
+ * @description Returns the node in the location of the path array obtained from "util.getNodePath".
338
+ * @param offsets Position array, array obtained from "util.getNodePath"
339
+ * @param parentNode Base parent element
340
+ * @returns
341
+ */
342
+ getNodeFromPath(offsets: number[], parentNode: Node): Node;
343
+
344
+ /**
345
+ * @description Compares the style and class for equal values.
346
+ * Returns true if both are text nodes.
347
+ * @param a Node to compare
348
+ * @param b Node to compare
349
+ * @returns
350
+ */
351
+ isSameAttributes(a: Node, b: Node): boolean;
352
+
353
+ /**
354
+ * @description Check the line element(util.isFormatElement) is empty.
355
+ * @param {Element} element Format element node
356
+ * @returns {Boolean}
357
+ */
358
+ isEmptyLine(element: Element): boolean;
359
+
360
+ /**
361
+ * @description Check the span's attributes are empty.
362
+ * @param {Element} element Element node
363
+ * @returns {Boolean}
364
+ */
365
+ isSpanWithoutAttr(element: Element|null): boolean;
366
+
367
+ /**
368
+ * @description Check the node is a list (ol, ul)
369
+ * @param node The element or element name to check
370
+ * @returns
371
+ */
372
+ isList(node: string | Node): boolean;
373
+
374
+ /**
375
+ * @description Check the node is a list cell (li)
376
+ * @param node The element or element name to check
377
+ * @returns
378
+ */
379
+ isListCell(node: string | Node): boolean;
380
+
381
+ /**
382
+ * @description Check the node is a table (table, thead, tbody, tr, th, td)
383
+ * @param node The element or element name to check
384
+ * @returns
385
+ */
386
+ isTable(node: string | Node): boolean;
387
+
388
+ /**
389
+ * @description Check the node is a table cell (td, th)
390
+ * @param node The element or element name to check
391
+ * @returns
392
+ */
393
+ isCell(node: string | Node): boolean;
394
+
395
+ /**
396
+ * @description Check the node is a break node (BR)
397
+ * @param node The element or element name to check
398
+ * @returns
399
+ */
400
+ isBreak(node: string | Node): boolean;
401
+
402
+ /**
403
+ * @description Check the node is a anchor node (A)
404
+ * @param node The element or element name to check
405
+ * @returns
406
+ */
407
+ isAnchor(node: string | Node): boolean;
408
+
409
+ /**
410
+ * @description Check the node is a media node (img, iframe, audio, video, canvas)
411
+ * @param node The element or element name to check
412
+ * @returns
413
+ */
414
+ isMedia(node: string | Node): boolean;
415
+
416
+ /**
417
+ * @description Checks for numeric (with decimal point).
418
+ * @param text Text string or number
419
+ * @returns
420
+ */
421
+ isNumber(text: string | number): boolean;
422
+
423
+ /**
424
+ * @description Get a number.
425
+ * @param text Text string or number
426
+ * @param maxDec Maximum number of decimal places (-1 : Infinity)
427
+ * @returns
428
+ */
429
+ getNumber(text: string | number, maxDec: number): number;
430
+
431
+ /**
432
+ * @description Get all "children" of the argument value element (Without text nodes)
433
+ * @param element element to get child node
434
+ * @param validation Conditional function
435
+ * @returns
436
+ */
437
+ getListChildren(element: Element, validation?: Function): Element[];
438
+
439
+ /**
440
+ * @description Get all "childNodes" of the argument value element (Include text nodes)
441
+ * @param element element to get child node
442
+ * @param validation Conditional function
443
+ * @returns
444
+ */
445
+ getListChildNodes(element: Node, validation?: Function): Node[];
446
+
447
+ /**
448
+ * @description Returns the number of parents nodes.
449
+ * "0" when the parent node is the WYSIWYG area.
450
+ * "-1" when the element argument is the WYSIWYG area.
451
+ * @param element The element to check
452
+ * @returns
453
+ */
454
+ getElementDepth(element: Node): number;
455
+
456
+ /**
457
+ * @description Compares two elements to find a common ancestor, and returns the order of the two elements.
458
+ * @param a Node to compare.
459
+ * @param b Node to compare.
460
+ * @returns
461
+ */
462
+ compareElements(a: Node, b: Node): {ancestor: Element | null, a: Node, b: Node, result: number};
463
+
464
+ /**
465
+ * @description Get the parent element of the argument value.
466
+ * A tag that satisfies the query condition is imported.
467
+ * Returns null if not found.
468
+ * @param element Reference element
469
+ * @param query Query String (nodeName, .className, #ID, :name) or validation function.
470
+ * Not use it like jquery.
471
+ * Only one condition can be entered at a time.
472
+ * @returns
473
+ */
474
+ getParentElement(element: Node, query: string | Function): Element;
475
+
476
+ /**
477
+ * @description Get the child element of the argument value.
478
+ * A tag that satisfies the query condition is imported.
479
+ * Returns null if not found.
480
+ * @param element Reference element
481
+ * @param query Query String (nodeName, .className, #ID, :name) or validation function.
482
+ * @param last If true returns the last node among the found child nodes. (default: first node)
483
+ * Not use it like jquery.
484
+ * Only one condition can be entered at a time.
485
+ * @returns
486
+ */
487
+ getChildElement(element: Node, query: string | Function, last: boolean): Element;
488
+
489
+ /**
490
+ * @description 1. The first node of all the child nodes of the "first" element is returned.
491
+ * 2. The last node of all the child nodes of the "last" element is returned.
492
+ * 3. When there is no "last" element, the first and last nodes of all the children of the "first" element are returned.
493
+ * { sc: "first", ec: "last" }
494
+ * @param first First element
495
+ * @param last Last element
496
+ * @returns
497
+ */
498
+ getEdgeChildNodes(first: Node, last?: Node): {sc: Node; ec: Node | null;};
499
+
500
+ /**
501
+ * @description Returns the position of the left and top of argument. {left:0, top:0}
502
+ * @param element Target node
503
+ * @param wysiwygFrame When use iframe option, iframe object should be sent (context.element.wysiwygFrame)
504
+ * @returns
505
+ */
506
+ getOffset(element: Node, wysiwygFrame?: Element): Record<string, number>;
507
+
508
+ /**
509
+ * @description It compares the start and end indexes of "a" and "b" and returns the number of overlapping indexes in the range.
510
+ * ex) 1, 5, 4, 6 => "2" (4 ~ 5)
511
+ * @param aStart Start index of "a"
512
+ * @param aEnd End index of "a"
513
+ * @param bStart Start index of "b"
514
+ * @param bEnd Start index of "b"
515
+ * @returns
516
+ */
517
+ getOverlapRangeAtIndex(aStart: number, aEnd: number, bStart: number, bEnd: number): number;
518
+
519
+ /**
520
+ * @description Set the text content value of the argument value element
521
+ * @param element Element to replace text content
522
+ * @param txt Text to be applied
523
+ */
524
+ changeTxt(element: Node, txt: string): void;
525
+
526
+ /**
527
+ * @description Replace icon
528
+ * @param element Target element
529
+ * @param newElement String or element of the new element to apply
530
+ */
531
+ changeElement(icon: Element, newIcon: string | Element): void;
532
+
533
+ /**
534
+ * @description Set style, if all styles are deleted, the style properties are deleted.
535
+ * @param element Element to set style
536
+ * @param styleName Style attribute name (marginLeft, textAlign...)
537
+ * @param value Style value
538
+ */
539
+ setStyle(element: Element, styleName: string, value: string | number): void;
540
+
541
+ /**
542
+ * @description Determine whether any of the matched elements are assigned the given class
543
+ * @param element Elements to search class name
544
+ * @param className Class name to search for
545
+ * @returns
546
+ */
547
+ hasClass(element: Element, className: string): boolean;
548
+
549
+ /**
550
+ * @description Append the className value of the argument value element
551
+ * @param element Elements to add class name
552
+ * @param className Class name to be add
553
+ */
554
+ addClass(element: Element, className: string): void;
555
+
556
+ /**
557
+ * @description Delete the className value of the argument value element
558
+ * @param element Elements to remove class name
559
+ * @param className Class name to be remove
560
+ */
561
+ removeClass(element: Element, className: string): void;
562
+
563
+ /**
564
+ * @description Argument value If there is no class name, insert it and delete the class name if it exists
565
+ * @param element Elements to replace class name
566
+ * @param className Class name to be change
567
+ * @returns
568
+ */
569
+ toggleClass(element: Element, className: string): boolean | undefined;
570
+
571
+ /**
572
+ * @description Checks if element can't be easily enabled
573
+ * @param {Element} element Element to check for
574
+ */
575
+ isImportantDisabled(element: Element): boolean;
576
+
577
+ /**
578
+ * @description In the predefined code view mode, the buttons except the executable button are changed to the 'disabled' state.
579
+ * core.codeViewDisabledButtons (An array of buttons whose class name is not "se-code-view-enabled")
580
+ * core.resizingDisabledButtons (An array of buttons whose class name is not "se-resizing-enabled")
581
+ * @param disabled Disabled value
582
+ * @param buttonList Button array
583
+ * @param important If priveleged mode should be used (Necessary to switch importantDisabled buttons)
584
+ */
585
+ setDisabledButtons(disabled: boolean, buttonList: Element[] | HTMLCollection | NodeList, important: Boolean): void;
586
+
587
+ /**
588
+ * @description Delete argumenu value element
589
+ * @param item Node to be remove
590
+ */
591
+ removeItem(item: Node): void;
592
+
593
+ /**
594
+ * @description Delete all parent nodes that match the condition.
595
+ * Returns an {sc: previousSibling, ec: nextSibling}(the deleted node reference) or null.
596
+ * @param item Node to be remove
597
+ * @param validation Validation function. default(Deleted if it only have breakLine and blanks)
598
+ * @param stopParent Stop when the parent node reaches stopParent
599
+ * @returns
600
+ */
601
+ removeItemAllParents(item: Node, validation?: Function, stopParent?: Element): Record<string, Node | null> | null;
602
+
603
+ /**
604
+ * @description Detach Nested all nested lists under the "baseNode".
605
+ * Returns a list with nested removed.
606
+ * @param baseNode Element on which to base.
607
+ * @param all If true, it also detach all nested lists of a returned list.
608
+ * @returns
609
+ */
610
+ detachNestedList(baseNode: Node, all: boolean): Element;
611
+
612
+ /**
613
+ * @description Split all tags based on "baseNode"
614
+ * Returns the last element of the splited tag.
615
+ * @param baseNode Element or text node on which to base
616
+ * @param offset Text offset of "baseNode" (Only valid when "baseNode" is a text node)
617
+ * @param depth The nesting depth of the element being split. (default: 0)
618
+ * @returns
619
+ */
620
+ splitElement(baseNode: Node, offset: number | null, depth: number): Element;
621
+
622
+ /**
623
+ * @description Use with "npdePath (util.getNodePath)" to merge the same attributes and tags if they are present and modify the nodepath.
624
+ * If "offset" has been changed, it will return as much "offset" as it has been modified.
625
+ * An array containing change offsets is returned in the order of the "nodePathArray" array.
626
+ * @param element Element
627
+ * @param nodePathArray Array of NodePath object ([util.getNodePath(), ..])
628
+ * @param onlyText If true, non-text nodes(!util._isIgnoreNodeChange) like 'span', 'strong'.. are ignored.
629
+ * @returns [offset, ..]
630
+ */
631
+ mergeSameTags(element: Element, nodePathArray: any[], onlyText: boolean): number[];
632
+
633
+ /**
634
+ * @description Remove nested tags without other child nodes.
635
+ * @param element Element object
636
+ * @param validation Validation function / String("tag1|tag2..") / If null, all tags are applicable.
637
+ */
638
+ mergeNestedTags(element: Element, validation?: string | Function): void;
639
+
640
+ /**
641
+ * @description Delete a empty child node of argument element
642
+ * @param element Element node
643
+ * @param notRemoveNode Do not remove node
644
+ */
645
+ removeEmptyNode(element: Element, notRemoveNode?: Node): void;
646
+
647
+ /**
648
+ * @description Remove whitespace between tags in HTML string.
649
+ * @param html HTML string
650
+ * @returns
651
+ */
652
+ htmlRemoveWhiteSpace(html: string): string;
653
+
654
+ /**
655
+ * @description Sort a element array by depth of element.
656
+ * @param array Array object
657
+ * @param des true: descending order / false: ascending order
658
+ */
659
+ sortByDepth(array: Node[], des: boolean): void;
660
+
661
+ /**
662
+ * @description Create whitelist RegExp object.
663
+ * Return RegExp format: new RegExp("<\\/?\\b(?!" + list + ")\\b[^>^<]*+>", "gi")
664
+ * @param list Tags list ("br|p|div|pre...")
665
+ * @returns
666
+ */
667
+ createTagsWhitelist(list: string): RegExp;
668
+
669
+ /**
670
+ * @description Create blacklist RegExp object.
671
+ * Return RegExp format: new RegExp("<\\/?\\b(?:" + list + ")\\b[^>^<]*+>", "gi")
672
+ * @param list Tags list ("br|p|div|pre...")
673
+ * @returns
674
+ */
675
+ createTagsBlacklist(list: string): RegExp;
676
+ }
677
+
678
678
  export default util;