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/config.ts CHANGED
@@ -94,13 +94,11 @@ export class Config implements IViewOptions {
94
94
 
95
95
  /**
96
96
  * Change the read-only state of the editor
97
- * @type {boolean}
98
97
  */
99
98
  readonly: boolean = false;
100
99
 
101
100
  /**
102
101
  * Change the disabled state of the editor
103
- * @type {boolean}
104
102
  */
105
103
  disabled: boolean = false;
106
104
 
@@ -132,8 +130,6 @@ export class Config implements IViewOptions {
132
130
 
133
131
  /**
134
132
  * Inline editing mode
135
- *
136
- * @type {boolean}
137
133
  */
138
134
  inline: boolean = false;
139
135
 
@@ -199,7 +195,7 @@ export class Config implements IViewOptions {
199
195
  * After all changes in editors for textarea will call change trigger
200
196
  *
201
197
  * @example
202
- * ```javascript
198
+ * ```javascript
203
199
  * var editor = new Jodit('#editor');
204
200
  * document.getElementById('editor').addEventListener('change', function () {
205
201
  * console.log(this.value);
@@ -257,7 +253,7 @@ export class Config implements IViewOptions {
257
253
  debugLanguage: boolean = false;
258
254
 
259
255
  /**
260
- * Collection of language pack data {en: {'Type something': 'Type something', ...}}
256
+ * Collection of language pack data `{en: {'Type something': 'Type something', ...}}`
261
257
  *
262
258
  * @example
263
259
  * ```javascript
@@ -304,7 +300,6 @@ export class Config implements IViewOptions {
304
300
 
305
301
  /**
306
302
  * Instead of create custop tooltip - use native title tooltips
307
- * @type {boolean}
308
303
  */
309
304
  useNativeTooltip: boolean = false;
310
305
 
@@ -341,8 +336,6 @@ export class Config implements IViewOptions {
341
336
 
342
337
  /**
343
338
  * Use split mode
344
- *
345
- * @type {boolean}
346
339
  */
347
340
  useSplitMode: boolean = false;
348
341
 
@@ -514,6 +507,7 @@ export class Config implements IViewOptions {
514
507
  * But for a declarative declaration, you can use this option.
515
508
  *
516
509
  * @example
510
+ * ```js
517
511
  * Jodit.modules.Icon.set('someIcon', '<svg><path.../></svg>');
518
512
  * const editor = Jodit.make({
519
513
  * extraButtons: [{
@@ -532,14 +526,16 @@ export class Config implements IViewOptions {
532
526
  * icon: 'someIcon'
533
527
  * }]
534
528
  * });
535
- *
529
+ * ```
536
530
  * @example
531
+ * ```js
537
532
  * const editor = Jodit.make({
538
533
  * extraButtons: [{
539
534
  * name: 'someButton',
540
535
  * icon: '<svg><path.../></svg>'
541
536
  * }]
542
537
  * });
538
+ * ```
543
539
  */
544
540
  extraIcons: IDictionary<string> = {};
545
541
 
@@ -624,7 +620,7 @@ export class Config implements IViewOptions {
624
620
  * return '<div>' + value + '</div>';
625
621
  * }
626
622
  * });
627
- * ```
623
+ * ```
628
624
  */
629
625
  buttons: ButtonsOption = [
630
626
  {
@@ -760,7 +756,7 @@ export class Config implements IViewOptions {
760
756
  ];
761
757
 
762
758
  /**
763
- * The list of buttons that appear in the editor's toolbar on extra small places (< options.sizeSM).
759
+ * The list of buttons that appear in the editor's toolbar on extra small places `(< options.sizeSM)`.
764
760
  */
765
761
  buttonsXS: ButtonsOption = [
766
762
  'bold',
@@ -787,13 +783,11 @@ export class Config implements IViewOptions {
787
783
 
788
784
  /**
789
785
  * Buttons in toolbat without SVG - only texts
790
- * @type {boolean}
791
786
  */
792
787
  textIcons: boolean = false;
793
788
 
794
789
  /**
795
790
  * shows a INPUT[type=color] to open the browser color picker, on the right bottom of widget color picker
796
- * @type {boolean}
797
791
  */
798
792
  showBrowserColorPicker: boolean = true;
799
793
 
package/src/core/ajax.ts CHANGED
@@ -23,35 +23,11 @@ import {
23
23
  ConfigProto
24
24
  } from './helpers';
25
25
 
26
- /**
27
- * @property {object} defaultAjaxOptions A set of key/value pairs that configure the Ajax request. All settings
28
- * are optional
29
- * @property {object} defaultAjaxOptions.headers An object of additional header key/value pairs toWYSIWYG send along
30
- * with requests using the XMLHttpRequest transport. Uses in {@link FileBrowser|FileBrowser}
31
- * and {@link Uploader|Uploader}
32
- * @property {string} defaultAjaxOptions.dataType='json' json or text The type of data that you're expecting back
33
- * from the server. if `json` the return value passes through the `JSON.parse`
34
- * @property {string} defaultAjaxOptions.method='GET' The HTTP method toWYSIWYG use for the request
35
- * (e.g. "POST", "GET", "PUT")
36
- * @property {string} defaultAjaxOptions.url='' A string containing the URL toWYSIWYG which the request is sent.
37
- * @property {string} defaultAjaxOptions.async=true By default, all requests are sent asynchronously (i.e. this is
38
- * set toWYSIWYG true by default). If you need synchronous requests, set this option toWYSIWYG false
39
- * @property {object|string} defaultAjaxOptions.data=null Data toWYSIWYG be sent toWYSIWYG the server.
40
- * It is converted toWYSIWYG a query string, if not already a string. It's appended toWYSIWYG the url for GET-requests.
41
- * @property {string} defaultAjaxOptions.contentType='application/x-www-form-urlencoded; charset=UTF-8'
42
- * When sending data toWYSIWYG the server, use this content type. Default is "application/x-www-form-urlencoded;
43
- * charset=UTF-8", which is fine for most cases
44
- * @property {boolean} defaultAjaxOptions.withCredentials=false
45
- * Enable or disable Access-Control-Allow-Credentials client side. Useful for cross domain requests
46
- * @property {function} defaultAjaxOptions.error=function () {} A function toWYSIWYG be called if the request fails
47
- * @property {function} defaultAjaxOptions.success=function (resp) {} A function toWYSIWYG be called if the
48
- * request succeeds
49
- * @property {function} defaultAjaxOptions.xhr=function () { return new XMLHttpRequest(); } Callback for creating
50
- * the XMLHttpRequest object.
51
- */
52
-
53
26
  declare module '../config' {
54
27
  interface Config {
28
+ /**
29
+ * A set of key/value pairs that configure the Ajax request. All settings are optional
30
+ */
55
31
  defaultAjaxOptions: AjaxOptions;
56
32
  }
57
33
  }
@@ -59,11 +35,8 @@ declare module '../config' {
59
35
  Config.prototype.defaultAjaxOptions = {
60
36
  dataType: 'json',
61
37
  method: 'GET',
62
-
63
38
  url: '',
64
-
65
39
  data: null,
66
-
67
40
  contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
68
41
 
69
42
  headers: {
@@ -82,7 +55,7 @@ export class Ajax implements IAjax {
82
55
 
83
56
  private readonly xhr!: XMLHttpRequest;
84
57
 
85
- private success_response_codes = [200, 201, 202];
58
+ private successResponseCodes = [200, 201, 202];
86
59
 
87
60
  private __buildParams(
88
61
  obj: string | IDictionary<string | object> | FormData,
@@ -130,16 +103,16 @@ export class Ajax implements IAjax {
130
103
  private resolved = false;
131
104
  private activated = false;
132
105
 
133
- send(): Promise<any> {
106
+ send<T = any>(): Promise<T> {
134
107
  this.activated = true;
135
108
 
136
109
  return new Promise(
137
110
  (
138
- resolve: (this: XMLHttpRequest, resp: object) => any,
111
+ resolve: (this: XMLHttpRequest, resp: T) => any,
139
112
  reject: (error: Error) => any
140
113
  ) => {
141
- const __parse = (resp: string): object => {
142
- let result: object | null = null;
114
+ const __parse = (resp: string): T => {
115
+ let result: T | null = null;
143
116
 
144
117
  if (this.o.dataType === 'json') {
145
118
  result = JSON.parse(resp);
@@ -169,7 +142,7 @@ export class Ajax implements IAjax {
169
142
  this.status = this.xhr.status;
170
143
  this.resolved = true;
171
144
 
172
- resolve.call(this.xhr, __parse(this.response) || {});
145
+ resolve.call(this.xhr, __parse(this.response) || ({} as T));
173
146
  };
174
147
 
175
148
  this.xhr.onprogress = (e): void => {
@@ -193,9 +166,8 @@ export class Ajax implements IAjax {
193
166
  this.resolved = true;
194
167
 
195
168
  if (
196
- this.success_response_codes.indexOf(
197
- this.xhr.status
198
- ) > -1
169
+ this.successResponseCodes.indexOf(this.xhr.status) >
170
+ -1
199
171
  ) {
200
172
  resolve.call(this.xhr, __parse(resp));
201
173
  } else {
@@ -230,7 +202,7 @@ export class Ajax implements IAjax {
230
202
  }
231
203
 
232
204
  // IE
233
- setTimeout(() => {
205
+ this.j.async.setTimeout(() => {
234
206
  this.xhr.send(data ? this.__buildParams(data) : undefined);
235
207
  }, 0);
236
208
  }
@@ -243,6 +215,7 @@ export class Ajax implements IAjax {
243
215
  }
244
216
 
245
217
  let url: string = this.o.url;
218
+
246
219
  const data = this.o.data;
247
220
  const method = (this.o.method || 'get').toLowerCase();
248
221
 
@@ -251,6 +224,7 @@ export class Ajax implements IAjax {
251
224
 
252
225
  if (qIndex !== -1) {
253
226
  const urlData = parseQuery(url);
227
+
254
228
  url =
255
229
  url.substr(0, qIndex) +
256
230
  '?' +
@@ -280,14 +254,10 @@ export class Ajax implements IAjax {
280
254
 
281
255
  this.xhr = this.o.xhr ? this.o.xhr() : new XMLHttpRequest();
282
256
 
283
- jodit &&
284
- jodit.events &&
285
- jodit.e.on('beforeDestruct', () => {
286
- this.abort();
287
- });
257
+ jodit && jodit.e && jodit.e.on('beforeDestruct', () => this.abort());
288
258
  }
289
259
 
290
- destruct(): any {
260
+ destruct(): void {
291
261
  if (this.activated && !this.resolved) {
292
262
  this.abort();
293
263
  this.resolved = true;
package/src/core/async.ts CHANGED
@@ -74,10 +74,6 @@ export class Async implements IAsync {
74
74
  * Debouncing enforces that a function not be called again until a certain amount of time has passed without
75
75
  * it being called. As in "execute this function only if 100 milliseconds have passed without it being called."
76
76
  *
77
- * @param {function} fn
78
- * @param {int} timeout
79
- * @return {function}
80
- *
81
77
  * @example
82
78
  * ```javascript
83
79
  * var jodit = new Jodit('.editor');
@@ -86,9 +82,6 @@ export class Async implements IAsync {
86
82
  * }, 100));
87
83
  * ```
88
84
  *
89
- * @param fn
90
- * @param timeout
91
- * @param firstCallImmediately
92
85
  */
93
86
  debounce(
94
87
  fn: CallbackFunction,
@@ -128,6 +121,7 @@ export class Async implements IAsync {
128
121
  }
129
122
 
130
123
  clearTimeout(timer);
124
+
131
125
  timer = this.setTimeout(
132
126
  () => callFn(...args),
133
127
  isFunction(timeout) ? timeout() : timeout
@@ -154,11 +148,6 @@ export class Async implements IAsync {
154
148
  * Throttling enforces a maximum number of times a function can be called over time.
155
149
  * As in "execute this function at most once every 100 milliseconds."
156
150
  *
157
- * @method throttle
158
- * @param {function} fn
159
- * @param {int} timeout
160
- * @param {context} [ctx] Context
161
- * @return {function}
162
151
  * @example
163
152
  * ```javascript
164
153
  * var jodit = new Jodit('.editor');
@@ -241,7 +230,6 @@ export class Async implements IAsync {
241
230
 
242
231
  /**
243
232
  * Get Promise status
244
- * @param p
245
233
  */
246
234
  promiseState(
247
235
  p: Promise<any>
@@ -282,7 +270,7 @@ export class Async implements IAsync {
282
270
 
283
271
  private requestIdleCallbackNative =
284
272
  (window as any)['requestIdleCallback']?.bind(window) ??
285
- ((callback: CallbackFunction): number => {
273
+ ((callback: IdleRequestCallback): number => {
286
274
  const start = Date.now();
287
275
 
288
276
  return this.setTimeout(() => {
@@ -299,14 +287,14 @@ export class Async implements IAsync {
299
287
  this.clearTimeout(request);
300
288
  });
301
289
 
302
- requestIdleCallback(callback: CallbackFunction): number {
290
+ requestIdleCallback(callback: IdleRequestCallback): number {
303
291
  const request = this.requestIdleCallbackNative(callback);
304
292
  this.requestsIdle.add(request);
305
293
  return request;
306
294
  }
307
295
 
308
- requestIdlePromise(): Promise<number> {
309
- return new Promise<number>(res => {
296
+ requestIdlePromise(): RejectablePromise<number> {
297
+ return this.promise<number>(res => {
310
298
  const request = this.requestIdleCallback(() => res(request));
311
299
  });
312
300
  }
@@ -330,6 +318,7 @@ export class Async implements IAsync {
330
318
  this.promisesRejections.forEach(reject => {
331
319
  reject();
332
320
  });
321
+
333
322
  this.promisesRejections.clear();
334
323
  }
335
324
 
@@ -33,7 +33,6 @@ export abstract class ViewComponent<T extends IViewBased = IViewBased>
33
33
 
34
34
  /**
35
35
  * Attach component to View
36
- * @param jodit
37
36
  */
38
37
  setParentView(jodit: T): this {
39
38
  this.jodit = jodit;
@@ -74,23 +74,23 @@ export const BR = 'br';
74
74
  export const PARAGRAPH = 'p';
75
75
 
76
76
  /**
77
- * @property {int} MODE_WYSIWYG=1 WYSIWYG editor mode
77
+ * WYSIWYG editor mode
78
78
  */
79
79
  export const MODE_WYSIWYG = 1;
80
80
 
81
81
  /**
82
- * @property {int} MODE_SOURCE=2 html editor mode
82
+ * html editor mode
83
83
  */
84
84
  export const MODE_SOURCE = 2;
85
85
 
86
86
  /**
87
- * @property {int} MODE_SPLIT=3 Source code editor and HTML editor both like
87
+ * Source code editor and HTML editor both like
88
88
  * {@link http://getuikit.com/docs/htmleditor.html|this}
89
89
  */
90
90
  export const MODE_SPLIT = 3;
91
91
 
92
92
  /**
93
- * @property {boolean} Is Internet Explorer
93
+ * Is Internet Explorer
94
94
  */
95
95
  export const IS_IE =
96
96
  typeof navigator !== 'undefined' &&
@@ -98,7 +98,7 @@ export const IS_IE =
98
98
  /rv:11.0/i.test(navigator.userAgent));
99
99
 
100
100
  /**
101
- * @property {string} TEXT_PLAIN='text/plain' For IE11 it will be 'text'. Need for dataTransfer.setData
101
+ * For IE11 it will be 'text'. Need for dataTransfer.setData
102
102
  */
103
103
  export const TEXT_PLAIN = IS_IE ? 'text' : 'text/plain';
104
104
  export const TEXT_HTML = IS_IE ? 'html' : 'text/html';
@@ -15,13 +15,11 @@ import type {
15
15
 
16
16
  import {
17
17
  isPlainObject,
18
- each,
19
18
  asArray,
20
- css,
21
19
  isFunction,
22
- kebabCase,
23
20
  refs,
24
- isString
21
+ isString,
22
+ attr
25
23
  } from './helpers/';
26
24
 
27
25
  import { Dom } from './dom';
@@ -39,23 +37,6 @@ export class Create implements ICreate {
39
37
  >
40
38
  ) {}
41
39
 
42
- /**
43
- * Apply some object key-value to HTMLElement
44
- */
45
- private applyAttributes = (elm: HTMLElement, attrs: Attributes) => {
46
- each(attrs, (key: string, value) => {
47
- if (isPlainObject(value) && key === 'style') {
48
- css(elm, value as IDictionary<string>);
49
- } else {
50
- if (key === 'className') {
51
- key = 'class';
52
- }
53
-
54
- elm.setAttribute(kebabCase(key), value.toString());
55
- }
56
- });
57
- };
58
-
59
40
  element<K extends keyof HTMLElementTagNameMap>(
60
41
  tagName: K,
61
42
  children?: Children
@@ -76,7 +57,7 @@ export class Create implements ICreate {
76
57
 
77
58
  if (childrenOrAttributes) {
78
59
  if (isPlainObject(childrenOrAttributes)) {
79
- this.applyAttributes(elm, childrenOrAttributes as Attributes);
60
+ attr(elm, <IDictionary>childrenOrAttributes);
80
61
  } else {
81
62
  children = childrenOrAttributes as Children;
82
63
  }
@@ -229,12 +210,12 @@ export class Create implements ICreate {
229
210
  const ca = this.createAttributes;
230
211
 
231
212
  if (ca && ca[elm.tagName.toLowerCase()]) {
232
- const attrs = ca[elm.tagName.toLowerCase()];
213
+ const attrsOpt = ca[elm.tagName.toLowerCase()];
233
214
 
234
- if (isFunction(attrs)) {
235
- attrs(elm);
236
- } else if (isPlainObject(attrs)) {
237
- this.applyAttributes(elm, attrs);
215
+ if (isFunction(attrsOpt)) {
216
+ attrsOpt(elm);
217
+ } else if (isPlainObject(attrsOpt)) {
218
+ attr(elm, <IDictionary>attrsOpt);
238
219
  }
239
220
  }
240
221
  }
@@ -22,10 +22,6 @@ import { Component, STATUSES } from '../component';
22
22
 
23
23
  /**
24
24
  * Wrap function in debounce wrapper
25
- *
26
- * @param timeout
27
- * @param firstCallImmediately
28
- * @param method
29
25
  */
30
26
  export function debounce<V = IViewComponent | IViewBased>(
31
27
  timeout?: number | ((ctx: V) => number | IAsyncParams) | IAsyncParams,
@@ -62,10 +58,6 @@ export function debounce<V = IViewComponent | IViewBased>(
62
58
 
63
59
  /**
64
60
  * Wrap function in throttle wrapper
65
- *
66
- * @param timeout
67
- * @param firstCallImmediately
68
- * @param method
69
61
  */
70
62
  export function throttle<V = IViewComponent | IViewBased>(
71
63
  timeout?: number | ((ctx: V) => number | IAsyncParams) | IAsyncParams,
@@ -15,7 +15,6 @@ import { error, isFunction } from '../helpers';
15
15
 
16
16
  /**
17
17
  * Call on some component status
18
- * @param timeout
19
18
  */
20
19
  export function hook(status: ComponentStatus) {
21
20
  return <T extends Component & IDictionary>(
@@ -5,8 +5,7 @@
5
5
  */
6
6
 
7
7
  /**
8
- * @enumerable decorator that sets the enumerable property of a class field to false.
9
- * @param value true|false
8
+ * Decorator that sets the enumerable property of a class field to false.
10
9
  */
11
10
  export const nonenumerable = (target: object, propertyKey: string): void => {
12
11
  const descriptor =
@@ -10,9 +10,6 @@ import { isViewObject } from '../helpers';
10
10
 
11
11
  /**
12
12
  * Allow save value inside persistent storage as set/get to property
13
- *
14
- * @param target
15
- * @param propertyKey
16
13
  */
17
14
  export function persistent<T extends IComponent>(
18
15
  target: T,
@@ -14,7 +14,6 @@ import { getClassName } from '../helpers/utils';
14
14
 
15
15
  /**
16
16
  * Allow spy for the class
17
- * @param target
18
17
  */
19
18
  export const spy = function spy(target: Function): void {
20
19
  const methods = Reflect.ownKeys(target.prototype);
@@ -10,7 +10,6 @@ import { STATUSES } from '../component';
10
10
 
11
11
  /**
12
12
  * Wrap function in wait wrapper, it will be called after `condition` returns `true`
13
- * @param condition
14
13
  */
15
14
  export function wait<T extends IViewBased>(
16
15
  condition: (ctx: T) => boolean