jodit 3.8.4 → 3.8.8

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 (245) hide show
  1. package/.idea/workspace.xml +165 -1308
  2. package/{.stylelintrc.json → .stylelintrc} +2 -1
  3. package/CHANGELOG.MD +54 -14
  4. package/build/jodit.css +280 -258
  5. package/build/jodit.es2018.css +231 -213
  6. package/build/jodit.es2018.en.css +231 -213
  7. package/build/jodit.es2018.en.js +9453 -9409
  8. package/build/jodit.es2018.en.min.css +1 -1
  9. package/build/jodit.es2018.en.min.js +1 -10
  10. package/build/jodit.es2018.js +13482 -13438
  11. package/build/jodit.es2018.min.css +1 -1
  12. package/build/jodit.es2018.min.js +1 -10
  13. package/build/jodit.js +9064 -9013
  14. package/build/jodit.min.css +2 -2
  15. package/build/jodit.min.js +1 -10
  16. package/build-system/index.js +78 -0
  17. package/{src/utils → build-system/loaders}/css-variables-prefixes.js +0 -0
  18. package/{src/utils → build-system/loaders}/lang-loader.js +0 -0
  19. package/build-system/loaders/style.js +31 -0
  20. package/{src/utils → build-system/loaders}/svg-loader.js +1 -0
  21. package/build-system/minimizer/css.js +20 -0
  22. package/build-system/minimizer/index.js +7 -0
  23. package/build-system/minimizer/js.js +41 -0
  24. package/{src/utils/plugin-loader.js → build-system/plugins/banner.js} +7 -6
  25. package/build-system/plugins/define.js +22 -0
  26. package/build-system/plugins/extract-css.js +14 -0
  27. package/build-system/plugins/index.js +31 -0
  28. package/build-system/plugins/post-build.js +52 -0
  29. package/build-system/rules/css.js +12 -0
  30. package/build-system/rules/extra-typescript.js +22 -0
  31. package/build-system/rules/index.js +17 -0
  32. package/build-system/rules/internal-typescript.js +23 -0
  33. package/build-system/rules/langs.js +20 -0
  34. package/build-system/rules/svg.js +19 -0
  35. package/build-system/utils/filename.js +17 -0
  36. package/{src → build-system}/utils/post-build.js +0 -0
  37. package/build-system/variables.js +53 -0
  38. package/package.json +34 -33
  39. package/src/config.ts +8 -14
  40. package/src/core/ajax.ts +16 -46
  41. package/src/core/async.ts +6 -17
  42. package/src/core/component/view-component.ts +0 -1
  43. package/src/core/constants.ts +5 -5
  44. package/src/core/create.ts +8 -27
  45. package/src/core/decorators/debounce.ts +0 -8
  46. package/src/core/decorators/hook.ts +0 -1
  47. package/src/core/decorators/nonenumerable.ts +1 -2
  48. package/src/core/decorators/persistent.ts +0 -3
  49. package/src/core/decorators/spy.ts +0 -1
  50. package/src/core/decorators/wait.ts +0 -1
  51. package/src/core/dom.ts +56 -114
  52. package/src/core/events/events-native.ts +52 -26
  53. package/src/core/events/observe-object.ts +0 -2
  54. package/src/core/global.ts +10 -6
  55. package/src/core/helpers/append-script.ts +0 -8
  56. package/src/core/helpers/array/as-array.ts +2 -5
  57. package/src/core/helpers/array/split-array.ts +0 -1
  58. package/src/core/helpers/async/set-timeout.ts +0 -7
  59. package/src/core/helpers/browser.ts +0 -1
  60. package/src/core/helpers/checker/has-browser-color-picker.ts +0 -3
  61. package/src/core/helpers/checker/is-array.ts +0 -1
  62. package/src/core/helpers/checker/is-equal.ts +0 -3
  63. package/src/core/helpers/checker/is-function.ts +0 -2
  64. package/src/core/helpers/checker/is-html-from-word.ts +0 -3
  65. package/src/core/helpers/checker/is-html.ts +0 -1
  66. package/src/core/helpers/checker/is-number.ts +0 -1
  67. package/src/core/helpers/checker/is-numeric.ts +0 -2
  68. package/src/core/helpers/checker/is-plain-object.ts +0 -1
  69. package/src/core/helpers/checker/is-string.ts +0 -1
  70. package/src/core/helpers/checker/is-url.ts +0 -4
  71. package/src/core/helpers/color/color-to-hex.ts +2 -2
  72. package/src/core/helpers/config-proto.ts +0 -3
  73. package/src/core/helpers/convert-media-url-to-video-embed.ts +1 -6
  74. package/src/core/helpers/ctrl-key.ts +1 -3
  75. package/src/core/helpers/data-bind.ts +0 -6
  76. package/src/core/helpers/default-language.ts +0 -3
  77. package/src/core/helpers/each.ts +12 -0
  78. package/src/core/helpers/html/htmlspecialchars.ts +0 -4
  79. package/src/core/helpers/html/nl2br.ts +0 -1
  80. package/src/core/helpers/human-size-to-bytes.ts +1 -4
  81. package/src/core/helpers/normalize/normalize-color.ts +2 -3
  82. package/src/core/helpers/normalize/normalize-key-aliases.ts +0 -2
  83. package/src/core/helpers/normalize/normalize-path.ts +0 -2
  84. package/src/core/helpers/normalize/normalize-size.ts +0 -3
  85. package/src/core/helpers/selector.ts +0 -8
  86. package/src/core/helpers/size/get-content-width.ts +0 -2
  87. package/src/core/helpers/size/offset.ts +1 -7
  88. package/src/core/helpers/size/position.ts +0 -4
  89. package/src/core/helpers/string/camel-case.ts +1 -2
  90. package/src/core/helpers/string/i18n.ts +0 -7
  91. package/src/core/helpers/string/kebab-case.ts +7 -5
  92. package/src/core/helpers/string/stringify.ts +0 -3
  93. package/src/core/helpers/string/trim.ts +0 -2
  94. package/src/core/helpers/string/ucfirst.ts +2 -5
  95. package/src/core/helpers/type.ts +0 -1
  96. package/src/core/helpers/utils/get.ts +0 -2
  97. package/src/core/helpers/utils/mark-deprecated.ts +0 -4
  98. package/src/core/helpers/utils/set.ts +0 -2
  99. package/src/core/helpers/utils/utils.ts +35 -14
  100. package/src/core/plugin-system.ts +0 -31
  101. package/src/core/selection/select.ts +15 -13
  102. package/src/core/selection/style/api/is-normal-node.ts +1 -2
  103. package/src/core/selection/style/api/toggle-styles.ts +0 -2
  104. package/src/core/selection/style/apply-style.ts +6 -2
  105. package/src/core/traits/mods.ts +1 -3
  106. package/src/core/ui/button/button/button.less +7 -3
  107. package/src/core/ui/button/button/button.ts +1 -1
  108. package/src/core/ui/button/group/group.less +5 -5
  109. package/src/core/ui/element.ts +0 -4
  110. package/src/core/ui/form/inputs/file/file.less +4 -4
  111. package/src/core/ui/form/validators/input.ts +0 -2
  112. package/src/core/ui/form/validators/select.ts +0 -1
  113. package/src/core/ui/helpers/get-control-type.ts +0 -2
  114. package/src/core/ui/icon.ts +0 -10
  115. package/src/core/ui/list/group.less +1 -1
  116. package/src/core/ui/list/group.ts +1 -6
  117. package/src/core/ui/list/list.ts +0 -3
  118. package/src/core/ui/popup/popup.ts +0 -11
  119. package/src/core/ui/progress-bar/progress-bar.less +8 -8
  120. package/src/core/view/view-with-toolbar.ts +0 -5
  121. package/src/core/view/view.ts +2 -18
  122. package/src/index.ts +1 -1
  123. package/src/jodit.ts +14 -70
  124. package/src/modules/context-menu/context-menu.ts +3 -6
  125. package/src/modules/dialog/alert.ts +0 -6
  126. package/src/modules/dialog/confirm.ts +1 -1
  127. package/src/modules/dialog/dialog.ts +22 -55
  128. package/src/modules/dialog/prompt.ts +3 -5
  129. package/src/modules/image-editor/image-editor.less +51 -46
  130. package/src/modules/status-bar/status-bar.less +12 -12
  131. package/src/modules/status-bar/status-bar.ts +0 -3
  132. package/src/modules/table.ts +17 -6
  133. package/src/modules/toolbar/button/button.less +5 -6
  134. package/src/modules/toolbar/button/button.ts +1 -1
  135. package/src/modules/toolbar/button/content.less +2 -2
  136. package/src/modules/widget/color-picker/color-picker.less +7 -6
  137. package/src/modules/widget/tabs/tabs.less +3 -3
  138. package/src/plugins/about/about.less +1 -1
  139. package/src/plugins/add-new-line/add-new-line.less +14 -15
  140. package/src/plugins/add-new-line/add-new-line.ts +1 -1
  141. package/src/plugins/clipboard/paste-storage/paste-storage.less +10 -11
  142. package/src/plugins/fix/clean-html.ts +2 -2
  143. package/src/plugins/fix/wrap-text-nodes.ts +1 -2
  144. package/src/plugins/fullsize/fullsize.less +5 -5
  145. package/src/plugins/image/image-properties/image-properties.less +11 -7
  146. package/src/plugins/image/image-properties/image-properties.ts +11 -8
  147. package/src/plugins/placeholder/placeholder.less +4 -4
  148. package/src/plugins/resizer/resizer.less +28 -23
  149. package/src/plugins/search/search.less +25 -25
  150. package/src/plugins/source/source.less +15 -15
  151. package/src/plugins/xpath/xpath.less +3 -3
  152. package/src/styles/form.less +19 -14
  153. package/src/styles/modules/button-group.less +2 -2
  154. package/src/styles/modules/icon.less +9 -8
  155. package/src/types/ajax.d.ts +28 -0
  156. package/src/types/async.d.ts +4 -3
  157. package/src/types/events.d.ts +15 -0
  158. package/tsconfig.json +1 -1
  159. package/types/config.d.ts +8 -14
  160. package/types/core/ajax.d.ts +6 -29
  161. package/types/core/async.d.ts +2 -15
  162. package/types/core/component/view-component.d.ts +0 -1
  163. package/types/core/constants.d.ts +5 -5
  164. package/types/core/create.d.ts +0 -4
  165. package/types/core/decorators/debounce.d.ts +0 -8
  166. package/types/core/decorators/hook.d.ts +0 -1
  167. package/types/core/decorators/nonenumerable.d.ts +1 -2
  168. package/types/core/decorators/persistent.d.ts +0 -3
  169. package/types/core/decorators/wait.d.ts +0 -1
  170. package/types/core/dom.d.ts +25 -112
  171. package/types/core/events/events-native.d.ts +18 -17
  172. package/types/core/events/observe-object.d.ts +0 -2
  173. package/types/core/global.d.ts +0 -4
  174. package/types/core/helpers/append-script.d.ts +0 -8
  175. package/types/core/helpers/array/as-array.d.ts +3 -0
  176. package/types/core/helpers/array/split-array.d.ts +0 -1
  177. package/types/core/helpers/async/set-timeout.d.ts +0 -7
  178. package/types/core/helpers/browser.d.ts +0 -1
  179. package/types/core/helpers/checker/has-browser-color-picker.d.ts +0 -3
  180. package/types/core/helpers/checker/is-array.d.ts +0 -1
  181. package/types/core/helpers/checker/is-equal.d.ts +0 -3
  182. package/types/core/helpers/checker/is-function.d.ts +0 -2
  183. package/types/core/helpers/checker/is-html-from-word.d.ts +0 -3
  184. package/types/core/helpers/checker/is-html.d.ts +0 -1
  185. package/types/core/helpers/checker/is-number.d.ts +0 -1
  186. package/types/core/helpers/checker/is-numeric.d.ts +0 -2
  187. package/types/core/helpers/checker/is-plain-object.d.ts +0 -1
  188. package/types/core/helpers/checker/is-string.d.ts +0 -1
  189. package/types/core/helpers/checker/is-url.d.ts +0 -4
  190. package/types/core/helpers/color/color-to-hex.d.ts +2 -2
  191. package/types/core/helpers/config-proto.d.ts +0 -3
  192. package/types/core/helpers/convert-media-url-to-video-embed.d.ts +1 -6
  193. package/types/core/helpers/ctrl-key.d.ts +1 -3
  194. package/types/core/helpers/data-bind.d.ts +0 -6
  195. package/types/core/helpers/default-language.d.ts +0 -3
  196. package/types/core/helpers/each.d.ts +9 -0
  197. package/types/core/helpers/html/htmlspecialchars.d.ts +0 -4
  198. package/types/core/helpers/html/nl2br.d.ts +0 -1
  199. package/types/core/helpers/human-size-to-bytes.d.ts +1 -4
  200. package/types/core/helpers/normalize/normalize-color.d.ts +2 -3
  201. package/types/core/helpers/normalize/normalize-key-aliases.d.ts +0 -2
  202. package/types/core/helpers/normalize/normalize-path.d.ts +0 -2
  203. package/types/core/helpers/normalize/normalize-size.d.ts +0 -3
  204. package/types/core/helpers/selector.d.ts +0 -8
  205. package/types/core/helpers/size/get-content-width.d.ts +0 -2
  206. package/types/core/helpers/size/offset.d.ts +1 -7
  207. package/types/core/helpers/string/camel-case.d.ts +1 -2
  208. package/types/core/helpers/string/i18n.d.ts +0 -7
  209. package/types/core/helpers/string/kebab-case.d.ts +1 -5
  210. package/types/core/helpers/string/stringify.d.ts +0 -3
  211. package/types/core/helpers/string/trim.d.ts +0 -2
  212. package/types/core/helpers/string/ucfirst.d.ts +1 -4
  213. package/types/core/helpers/type.d.ts +0 -1
  214. package/types/core/helpers/utils/get.d.ts +0 -2
  215. package/types/core/helpers/utils/mark-deprecated.d.ts +0 -4
  216. package/types/core/helpers/utils/set.d.ts +0 -2
  217. package/types/core/helpers/utils/utils.d.ts +4 -15
  218. package/types/core/plugin-system.d.ts +0 -31
  219. package/types/core/selection/select.d.ts +8 -9
  220. package/types/core/selection/style/api/toggle-styles.d.ts +0 -2
  221. package/types/core/traits/mods.d.ts +1 -3
  222. package/types/core/ui/element.d.ts +0 -4
  223. package/types/core/ui/form/validators/input.d.ts +0 -2
  224. package/types/core/ui/form/validators/select.d.ts +0 -1
  225. package/types/core/ui/helpers/get-control-type.d.ts +0 -2
  226. package/types/core/ui/icon.d.ts +0 -10
  227. package/types/core/ui/list/group.d.ts +1 -6
  228. package/types/core/ui/list/list.d.ts +0 -3
  229. package/types/core/ui/popup/popup.d.ts +0 -11
  230. package/types/core/view/view-with-toolbar.d.ts +0 -5
  231. package/types/core/view/view.d.ts +2 -18
  232. package/types/index.d.ts +1 -1
  233. package/types/jodit.d.ts +2 -46
  234. package/types/modules/context-menu/context-menu.d.ts +3 -6
  235. package/types/modules/dialog/alert.d.ts +0 -6
  236. package/types/modules/dialog/confirm.d.ts +1 -1
  237. package/types/modules/dialog/dialog.d.ts +9 -29
  238. package/types/modules/dialog/prompt.d.ts +3 -5
  239. package/types/modules/status-bar/status-bar.d.ts +0 -3
  240. package/types/modules/table.d.ts +1 -1
  241. package/types/types/ajax.d.ts +28 -0
  242. package/types/types/async.d.ts +4 -3
  243. package/types/types/events.d.ts +15 -0
  244. package/src/utils/create-entries.js +0 -57
  245. package/src/utils/lang-translater.js +0 -142
package/src/core/dom.ts CHANGED
@@ -10,11 +10,14 @@ import type {
10
10
  ICreate,
11
11
  IJodit,
12
12
  NodeCondition,
13
- Nullable
13
+ Nullable,
14
+ IDictionary
14
15
  } from '../types';
15
16
  import * as consts from './constants';
16
17
  import {
18
+ $$,
17
19
  asArray,
20
+ attr,
18
21
  css,
19
22
  dataBind,
20
23
  error,
@@ -26,6 +29,7 @@ import {
26
29
  toArray,
27
30
  trim
28
31
  } from './helpers';
32
+ import { Select } from './selection';
29
33
 
30
34
  /**
31
35
  * Module for working with DOM
@@ -33,7 +37,6 @@ import {
33
37
  export class Dom {
34
38
  /**
35
39
  * Remove all content from element
36
- * @param node
37
40
  */
38
41
  static detach(node: Node): void {
39
42
  while (node.firstChild) {
@@ -43,10 +46,6 @@ export class Dom {
43
46
 
44
47
  /**
45
48
  * Wrap all inline siblings
46
- *
47
- * @param current
48
- * @param tag
49
- * @param editor
50
49
  */
51
50
  static wrapInline(
52
51
  current: Node,
@@ -107,10 +106,6 @@ export class Dom {
107
106
 
108
107
  /**
109
108
  * Wrap node inside another node
110
- *
111
- * @param current
112
- * @param tag
113
- * @param editor
114
109
  */
115
110
  static wrap<K extends HTMLTagNames>(
116
111
  current: Node,
@@ -138,7 +133,6 @@ export class Dom {
138
133
 
139
134
  /**
140
135
  * Remove parent of node and insert this node instead that parent
141
- * @param node
142
136
  */
143
137
  static unwrap(node: Node): void {
144
138
  const parent = node.parentNode;
@@ -155,8 +149,8 @@ export class Dom {
155
149
  /**
156
150
  * It goes through all the internal elements of the node, causing a callback function
157
151
  *
158
- * @param elm elements , the internal node is necessary to sort out
159
- * @param callback It called for each item found
152
+ * @param elm - the element whose children and descendants you want to iterate over
153
+ * @param callback - It called for each item found
160
154
  * @example
161
155
  * ```javascript
162
156
  * Jodit.modules.Dom.each(parent.s.current(), function (node) {
@@ -195,9 +189,6 @@ export class Dom {
195
189
 
196
190
  /**
197
191
  * Call function for all nodes between `start` and `end`
198
- *
199
- * @param start
200
- * @param end
201
192
  */
202
193
  static between(
203
194
  start: Node,
@@ -228,12 +219,10 @@ export class Dom {
228
219
  /**
229
220
  * Replace one tag to another transfer content
230
221
  *
231
- * @param {Node} elm The element that needs to be replaced by new
232
- * @param {string} newTagName tag name for which will change `elm`
233
- * @param {boolean} withAttributes=false If true move tag's attributes
234
- * @param {boolean} notMoveContent=false false - Move content from elm to newTagName
235
- * @param {Document} [doc=document]
236
- * @return {Node} Returns a new tag
222
+ * @param elm - The element that needs to be replaced by new
223
+ * @param newTagName - tag name for which will change `elm`
224
+ * @param withAttributes - If true move tag's attributes
225
+ * @param notMoveContent - false - Move content from elm to newTagName
237
226
  * @example
238
227
  * ```javascript
239
228
  * Jodit.modules.Dom.replace(parent.editor.getElementsByTagName('span')[0], 'p');
@@ -274,8 +263,7 @@ export class Dom {
274
263
  * Checks whether the Node text and blank (in this case it may contain invisible auxiliary characters ,
275
264
  * it is also empty )
276
265
  *
277
- * @param {Node} node The element of wood to be checked
278
- * @return {Boolean} true element is empty
266
+ * @param node - The element of wood to be checked
279
267
  */
280
268
  static isEmptyTextNode(node: Node): boolean {
281
269
  return (
@@ -288,10 +276,6 @@ export class Dom {
288
276
 
289
277
  /**
290
278
  * Check if element is empty
291
- *
292
- * @param {Node} node
293
- * @param {RegExp} condNoEmptyElement
294
- * @return {boolean}
295
279
  */
296
280
  static isEmpty(
297
281
  node: Node,
@@ -345,7 +329,6 @@ export class Dom {
345
329
 
346
330
  /**
347
331
  * Check if element is table cell
348
- * @param elm
349
332
  */
350
333
  static isCell(elm: unknown): elm is HTMLTableCellElement {
351
334
  return Dom.isNode(elm) && /^(td|th)$/i.test(elm.nodeName);
@@ -353,9 +336,6 @@ export class Dom {
353
336
 
354
337
  /**
355
338
  * Check is element is Image element
356
- *
357
- * @param {Node} elm
358
- * @return {boolean}
359
339
  */
360
340
  static isImage(elm: unknown): elm is HTMLImageElement {
361
341
  return (
@@ -378,7 +358,6 @@ export class Dom {
378
358
 
379
359
  /**
380
360
  * Check if element is text node
381
- * @param node
382
361
  */
383
362
  static isText(node: Node | null | false): node is Text {
384
363
  return Boolean(node && node.nodeType === Node.TEXT_NODE);
@@ -386,11 +365,8 @@ export class Dom {
386
365
 
387
366
  /**
388
367
  * Check if element is element node
389
- * @param node
390
368
  */
391
- static isElement(
392
- node: Node | null | false | EventTarget | object
393
- ): node is Element {
369
+ static isElement(node: unknown): node is Element {
394
370
  if (!Dom.isNode(node)) {
395
371
  return false;
396
372
  }
@@ -402,7 +378,6 @@ export class Dom {
402
378
 
403
379
  /**
404
380
  * Check if element is HTMLElement node
405
- * @param node
406
381
  */
407
382
  static isHTMLElement(node: unknown): node is HTMLElement {
408
383
  if (!Dom.isNode(node)) {
@@ -416,7 +391,6 @@ export class Dom {
416
391
 
417
392
  /**
418
393
  * Check element is inline block
419
- * @param node
420
394
  */
421
395
  static isInlineBlock(node: Node | null | false): node is HTMLElement {
422
396
  return (
@@ -444,9 +418,6 @@ export class Dom {
444
418
 
445
419
  /**
446
420
  * Get last matched node inside root
447
- *
448
- * @param root
449
- * @param condition
450
421
  */
451
422
  static last(
452
423
  root: Nullable<Node>,
@@ -489,11 +460,6 @@ export class Dom {
489
460
 
490
461
  /**
491
462
  * Find previous node
492
- *
493
- * @param node
494
- * @param condition
495
- * @param root
496
- * @param [withChild]
497
463
  */
498
464
  static prev(
499
465
  node: Node,
@@ -513,11 +479,6 @@ export class Dom {
513
479
 
514
480
  /**
515
481
  * Find next node what `condition(next) === true`
516
- *
517
- * @param node
518
- * @param condition
519
- * @param root
520
- * @param [withChild]
521
482
  */
522
483
  static next(
523
484
  node: Node,
@@ -563,13 +524,6 @@ export class Dom {
563
524
 
564
525
  /**
565
526
  * Find next/prev node what `condition(next) === true`
566
- *
567
- * @param node
568
- * @param condition
569
- * @param root
570
- * @param [recurse] check first argument
571
- * @param [sibling] nextSibling or previousSibling
572
- * @param [child] firstChild or lastChild
573
527
  */
574
528
  static find(
575
529
  node: Node,
@@ -620,12 +574,6 @@ export class Dom {
620
574
 
621
575
  /**
622
576
  * Find next/prev node what `condition(next) === true`
623
- *
624
- * @param node
625
- * @param condition
626
- * @param root
627
- * @param [sibling] nextSibling or previousSibling
628
- * @param [child] firstChild or lastChild
629
577
  */
630
578
  static findWithCurrent(
631
579
  node: Node,
@@ -669,10 +617,6 @@ export class Dom {
669
617
 
670
618
  /**
671
619
  * Get not empty sibling
672
- *
673
- * @param node
674
- * @param [left]
675
- * @param [cond]
676
620
  */
677
621
  static findSibling(
678
622
  node: Node,
@@ -694,11 +638,6 @@ export class Dom {
694
638
 
695
639
  /**
696
640
  * It goes through all the elements in ascending order, and checks to see if they meet the predetermined condition
697
- *
698
- * @param node
699
- * @param condition
700
- * @param [root] Root element
701
- * @param [checkRoot]
702
641
  */
703
642
  static up<T extends HTMLElement>(
704
643
  node: Nullable<Node>,
@@ -733,10 +672,6 @@ export class Dom {
733
672
 
734
673
  /**
735
674
  * Find parent by tag name
736
- *
737
- * @param node
738
- * @param tags
739
- * @param root
740
675
  */
741
676
  static closest<T extends HTMLElement, K extends HTMLTagNames>(
742
677
  node: Nullable<Node>,
@@ -784,10 +719,6 @@ export class Dom {
784
719
 
785
720
  /**
786
721
  * Furthest parent node matching condition
787
- *
788
- * @param node
789
- * @param condition
790
- * @param root
791
722
  */
792
723
  static furthest<T extends HTMLElement>(
793
724
  node: Nullable<Node>,
@@ -807,8 +738,6 @@ export class Dom {
807
738
 
808
739
  /**
809
740
  * Append new element in the start of root
810
- * @param root
811
- * @param newElement
812
741
  */
813
742
  static appendChildFirst(
814
743
  root: HTMLElement,
@@ -827,9 +756,6 @@ export class Dom {
827
756
 
828
757
  /**
829
758
  * Insert newElement after element
830
- *
831
- * @param elm
832
- * @param newElement
833
759
  */
834
760
  static after(elm: Node, newElement: Node | DocumentFragment): void {
835
761
  const { parentNode } = elm;
@@ -847,9 +773,6 @@ export class Dom {
847
773
 
848
774
  /**
849
775
  * Insert newElement before element
850
- *
851
- * @param elm
852
- * @param newElement
853
776
  */
854
777
  static before(elm: Node, newElement: Node | DocumentFragment): void {
855
778
  const { parentNode } = elm;
@@ -863,9 +786,6 @@ export class Dom {
863
786
 
864
787
  /**
865
788
  * Insert newElement as first child inside element
866
- *
867
- * @param elm
868
- * @param newElement
869
789
  */
870
790
  static prepend(root: Node, newElement: Node | DocumentFragment): void {
871
791
  root.insertBefore(newElement, root.firstChild);
@@ -873,9 +793,6 @@ export class Dom {
873
793
 
874
794
  /**
875
795
  * Insert newElement as last child inside element
876
- *
877
- * @param elm
878
- * @param newElement
879
796
  */
880
797
  static append(
881
798
  root: Node,
@@ -899,10 +816,6 @@ export class Dom {
899
816
 
900
817
  /**
901
818
  * Move all content to another element
902
- *
903
- * @param from
904
- * @param to
905
- * @param inStart
906
819
  */
907
820
  static moveContent(from: Node, to: Node, inStart: boolean = false): void {
908
821
  const fragment: DocumentFragment = (
@@ -922,10 +835,6 @@ export class Dom {
922
835
 
923
836
  /**
924
837
  * Call callback condition function for all elements of node
925
- *
926
- * @param node
927
- * @param condition
928
- * @param prev
929
838
  */
930
839
  static all(
931
840
  node: Node,
@@ -951,10 +860,6 @@ export class Dom {
951
860
 
952
861
  /**
953
862
  * Check root contains child or equal child
954
- *
955
- * @param root
956
- * @param child
957
- * @param [onlyContains]
958
863
  */
959
864
  static isOrContains(
960
865
  root: Node,
@@ -972,7 +877,6 @@ export class Dom {
972
877
 
973
878
  /**
974
879
  * Safe remove element from DOM
975
- * @param node
976
880
  */
977
881
  static safeRemove(node: Node | false | null | void): void {
978
882
  node && node.parentNode && node.parentNode.removeChild(node);
@@ -980,7 +884,6 @@ export class Dom {
980
884
 
981
885
  /**
982
886
  * Hide element
983
- * @param node
984
887
  */
985
888
  static hide(node: Nullable<HTMLElement>): void {
986
889
  if (!node) {
@@ -993,7 +896,6 @@ export class Dom {
993
896
 
994
897
  /**
995
898
  * Show element
996
- * @param node
997
899
  */
998
900
  static show(node: Nullable<HTMLElement>): void {
999
901
  if (!node) {
@@ -1009,9 +911,6 @@ export class Dom {
1009
911
 
1010
912
  /**
1011
913
  * Check if element is some tag
1012
- *
1013
- * @param node
1014
- * @param tagNames
1015
914
  */
1016
915
  static isTag<K extends keyof HTMLElementTagNameMap>(
1017
916
  node: Node | null | false | EventTarget,
@@ -1040,4 +939,47 @@ export class Dom {
1040
939
 
1041
940
  return false;
1042
941
  }
942
+
943
+ /**
944
+ * Marks an item as temporary
945
+ */
946
+ static markTemporary<K extends HTMLElement>(
947
+ element: K,
948
+ attributes?: IDictionary
949
+ ): K {
950
+ attributes && attr(element, attributes);
951
+ attr(element, 'data-jodit-temp', true);
952
+ return element;
953
+ }
954
+
955
+ /**
956
+ * Check if element is temporary
957
+ */
958
+ static isTemporary(element: unknown): boolean {
959
+ if (!Dom.isElement(element)) {
960
+ return false;
961
+ }
962
+
963
+ return (
964
+ Select.isMarker(element) ||
965
+ attr(element, 'data-jodit-temp') === 'true'
966
+ );
967
+ }
968
+
969
+ /**
970
+ * Replace temporary elements from string
971
+ */
972
+ static replaceTemporaryFromString(value: string): string {
973
+ return value.replace(
974
+ /<([a-z]+)[^>]+data-jodit-temp[^>]+>(.+?)<\/\1>/gi,
975
+ '$2'
976
+ );
977
+ }
978
+
979
+ /**
980
+ * Get temporary list
981
+ */
982
+ static temporaryList(root: HTMLElement): HTMLElement[] {
983
+ return $$('[data-jodit-temp]', root);
984
+ }
1043
985
  }
@@ -20,6 +20,26 @@ import { isArray } from '../helpers/checker/is-array';
20
20
  import { error } from '../helpers/type';
21
21
 
22
22
  export class EventsNative implements IEventsNative {
23
+ private mutedEvents: Set<string> = new Set();
24
+
25
+ mute(event?: string): this {
26
+ this.mutedEvents.add(event ?? '*');
27
+ return this;
28
+ }
29
+
30
+ isMuted(event?: string): boolean {
31
+ if (event && this.mutedEvents.has(event)) {
32
+ return true;
33
+ }
34
+
35
+ return this.mutedEvents.has('*');
36
+ }
37
+
38
+ unmute(event?: string): this {
39
+ this.mutedEvents.delete(event ?? '*');
40
+ return this;
41
+ }
42
+
23
43
  readonly __key: string = '__JoditEventsNativeNamespaces';
24
44
 
25
45
  private doc: Document = document;
@@ -160,16 +180,17 @@ export class EventsNative implements IEventsNative {
160
180
  get current(): string {
161
181
  return this.currents[this.currents.length - 1];
162
182
  }
183
+
163
184
  currents: string[] = [];
164
185
 
165
186
  /**
166
187
  * Sets the handler for the specified event ( Event List ) for a given element .
167
188
  *
168
- * @param {object|string} subjectOrEvents - The object for which toWYSIWYG set an event handler
169
- * @param {string|Function} eventsOrCallback - List of events , separated by a space or comma
170
- * @param {function} [handlerOrSelector] - The event handler
171
- * @param {selector} [selector] - Selector for capturing
172
- * @param {Boolean} [onTop=false] - Set handler in first
189
+ * @param subjectOrEvents - The object for which toWYSIWYG set an event handler
190
+ * @param eventsOrCallback - List of events , separated by a space or comma
191
+ * @param handlerOrSelector - The event handler
192
+ * @param selector - Selector for capturing
193
+ * @param onTop - Set handler in first
173
194
  *
174
195
  * @example
175
196
  * ```javascript
@@ -246,12 +267,16 @@ export class EventsNative implements IEventsNative {
246
267
  const isDOMElement = isFunction((subject as any).addEventListener),
247
268
  self: EventsNative = this;
248
269
 
249
- let syntheticCallback = function (
270
+ let syntheticCallback: CallbackFunction = function (
250
271
  this: any,
251
- event: MouseEvent | TouchEvent,
272
+ event: string,
252
273
  ...args: any[]
253
- ) {
254
- return callback && callback.call(this, event, ...args);
274
+ ): any {
275
+ if (self.isMuted(event)) {
276
+ return;
277
+ }
278
+
279
+ return callback && callback.call(this, ...args);
255
280
  };
256
281
 
257
282
  if (isDOMElement) {
@@ -259,6 +284,10 @@ export class EventsNative implements IEventsNative {
259
284
  this: any,
260
285
  event: MouseEvent | TouchEvent
261
286
  ): void | false {
287
+ if (self.isMuted(event.type)) {
288
+ return;
289
+ }
290
+
262
291
  self.prepareEvent(event as TouchEvent);
263
292
 
264
293
  if (callback && callback.call(this, event) === false) {
@@ -342,10 +371,10 @@ export class EventsNative implements IEventsNative {
342
371
  /**
343
372
  * Disable all handlers specified event ( Event List ) for a given element. Either a specific event handler.
344
373
  *
345
- * @param {object} subjectOrEvents - The object which is disabled handlers
346
- * @param {string|Function} [eventsOrCallback] - List of events, separated by a space or comma , which is necessary
374
+ * @param subjectOrEvents - The object which is disabled handlers
375
+ * @param eventsOrCallback - List of events, separated by a space or comma , which is necessary
347
376
  * toWYSIWYG disable the handlers for a given object
348
- * @param {function} [handler] - Specific event handler toWYSIWYG be removed
377
+ * @param handler - Specific event handler toWYSIWYG be removed
349
378
  *
350
379
  * @example
351
380
  * ```javascript
@@ -461,9 +490,6 @@ export class EventsNative implements IEventsNative {
461
490
 
462
491
  /**
463
492
  * Stop execute all another listeners for this event
464
- *
465
- * @param subjectOrEvents
466
- * @param eventsList
467
493
  */
468
494
  stopPropagation(events: string): void;
469
495
  stopPropagation(subject: object, eventsList: string): void;
@@ -524,10 +550,10 @@ export class EventsNative implements IEventsNative {
524
550
  /**
525
551
  * Sets the handler for the specified event (Event List) for a given element .
526
552
  *
527
- * @param {object|string} subjectOrEvents - The object which is caused by certain events
528
- * @param {string|Array} eventsList - List of events , separated by a space or comma
529
- * @param {Array} [args] - Options for the event handler
530
- * @return {boolean} `false` if one of the handlers return `false`
553
+ * @param subjectOrEvents - The object which is caused by certain events
554
+ * @param eventsList - List of events , separated by a space or comma
555
+ * @param args - Options for the event handler
556
+ * @returns `false` if one of the handlers return `false`
531
557
  * @example
532
558
  * ```javascript
533
559
  * var dialog = new Jodit.modules.Dialog();
@@ -537,13 +563,13 @@ export class EventsNative implements IEventsNative {
537
563
  * dialog.open('Hello world!!!');
538
564
  * ```
539
565
  * or you can trigger native browser listener
540
- * ```javascript
566
+ * ```javascript
541
567
  * var events = new Jodit.modules.EventsNative();
542
568
  * events.on(document.body, 'click',function (event) {
543
569
  * alert('click on ' + event.target.id );
544
570
  * });
545
571
  * events.fire(document.body.querySelector('div'), 'click');
546
- * ```
572
+ * ```
547
573
  *
548
574
  */
549
575
  fire(subjectOrEvents: string, ...args: any[]): any;
@@ -603,11 +629,11 @@ export class EventsNative implements IEventsNative {
603
629
 
604
630
  this.currents.push(event);
605
631
 
606
- result_value =
607
- block.syntheticCallback.apply(
608
- subject,
609
- argumentsList
610
- );
632
+ result_value = block.syntheticCallback.call(
633
+ subject,
634
+ event,
635
+ ...argumentsList
636
+ );
611
637
 
612
638
  this.currents.pop();
613
639
 
@@ -100,8 +100,6 @@ export class ObserveObject {
100
100
 
101
101
  /**
102
102
  * Add listener on some changes
103
- * @param event
104
- * @param callback
105
103
  */
106
104
  on(event: string | string[], callback: CallbackFunction): this {
107
105
  if (isArray(event)) {
@@ -58,10 +58,6 @@ const boxes = new WeakMap<IComponent, IDictionary<HTMLElement>>();
58
58
 
59
59
  /**
60
60
  * Create unique box(HTMLCotainer) and remove it after destroy
61
- *
62
- * @param jodit
63
- * @param name
64
- * @param [tag]
65
61
  */
66
62
  export function getContainer<T extends HTMLTagNames = HTMLTagNames>(
67
63
  jodit: IViewBased | IViewComponent,
@@ -78,7 +74,10 @@ export function getContainer<T extends HTMLTagNames = HTMLTagNames>(
78
74
 
79
75
  if (!data[key]) {
80
76
  let c = view.c,
81
- body = jodit.od.body;
77
+ body =
78
+ isJoditObject(jodit) && jodit.o.shadowRoot
79
+ ? jodit.o.shadowRoot
80
+ : jodit.od.body;
82
81
 
83
82
  if (
84
83
  createInsideEditor &&
@@ -86,7 +85,12 @@ export function getContainer<T extends HTMLTagNames = HTMLTagNames>(
86
85
  jodit.od !== jodit.ed
87
86
  ) {
88
87
  c = jodit.createInside;
89
- body = tag === 'style' ? jodit.ed.head : jodit.ed.body;
88
+ const place = tag === 'style' ? jodit.ed.head : jodit.ed.body;
89
+
90
+ body =
91
+ isJoditObject(jodit) && jodit.o.shadowRoot
92
+ ? jodit.o.shadowRoot
93
+ : place;
90
94
  }
91
95
 
92
96
  const box = c.element(tag, {
@@ -33,11 +33,6 @@ const cacheLoaders = (loader: Loader): Loader => {
33
33
 
34
34
  /**
35
35
  * Append script in document and call callback function after download
36
- *
37
- * @param url
38
- * @param callback
39
- * @param className
40
- * @param doc
41
36
  */
42
37
  export const appendScript = (
43
38
  jodit: IViewBased,
@@ -79,9 +74,6 @@ export const appendScriptAsync = cacheLoaders(
79
74
 
80
75
  /**
81
76
  * Download CSS style script
82
- *
83
- * @param url
84
- * @param doc
85
77
  */
86
78
  export const appendStyleAsync = cacheLoaders(
87
79
  (jodit: IViewBased, url: string): Promise<HTMLElement> => {
@@ -4,12 +4,9 @@
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
 
7
+ import { isArray } from '../checker/is-array';
8
+
7
9
  /**
8
10
  * Always return Array
9
- *
10
- * @param a
11
- * @return {Array}
12
11
  */
13
- import { isArray } from '../checker/is-array';
14
-
15
12
  export const asArray = <T>(a: T[] | T): T[] => (isArray(a) ? a : [a]);
@@ -8,7 +8,6 @@ import { isString } from '../checker/is-string';
8
8
 
9
9
  /**
10
10
  * Split separated elements
11
- * @param a
12
11
  */
13
12
  export function splitArray(a: string): string[];
14
13
 
@@ -6,12 +6,6 @@
6
6
 
7
7
  /**
8
8
  * Create async callback if set timeout value - else call function immediately
9
- *
10
- * @param callback
11
- * @param timeout
12
- * @param a1
13
- * @param a2
14
- * @param a3
15
9
  */
16
10
  export function setTimeout<T = any>(
17
11
  callback: (...args: T[]) => void,
@@ -29,7 +23,6 @@ export function setTimeout<T = any>(
29
23
 
30
24
  /**
31
25
  * Clear timeout
32
- * @param timer
33
26
  */
34
27
  export function clearTimeout(timer: number): void {
35
28
  window.clearTimeout(timer);
@@ -6,7 +6,6 @@
6
6
 
7
7
  /**
8
8
  * Module returns method that is used to determine the browser
9
- * @params {Object} parent main Jodit object
10
9
  * @example
11
10
  * ```javascript
12
11
  * console.log(Jodit.modules.Helpers.browser('mse'));