jodit 4.5.8 → 4.5.11

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 (70) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +76 -29
  5. package/es2015/jodit.min.js +2 -2
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.css +1 -1
  13. package/es2018/jodit.fat.min.js +2 -2
  14. package/es2018/jodit.js +79 -29
  15. package/es2018/jodit.min.js +2 -2
  16. package/es2018/plugins/debug/debug.css +1 -1
  17. package/es2018/plugins/debug/debug.js +1 -1
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  22. package/es2021/jodit.css +1 -1
  23. package/es2021/jodit.fat.min.js +2 -2
  24. package/es2021/jodit.js +79 -28
  25. package/es2021/jodit.min.js +2 -2
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +1 -1
  33. package/es2021.en/jodit.fat.min.js +2 -2
  34. package/es2021.en/jodit.js +79 -28
  35. package/es2021.en/jodit.min.js +2 -2
  36. package/es2021.en/plugins/debug/debug.css +1 -1
  37. package/es2021.en/plugins/debug/debug.js +1 -1
  38. package/es2021.en/plugins/debug/debug.min.js +1 -1
  39. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  40. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  42. package/es5/415.fat.min.js +10 -0
  43. package/es5/{975.js → 415.js} +604 -604
  44. package/es5/415.min.js +10 -0
  45. package/es5/5.fat.min.js +2 -2
  46. package/es5/5.js +5 -5
  47. package/es5/5.min.js +2 -2
  48. package/es5/jodit.css +2 -2
  49. package/es5/jodit.fat.min.js +2 -2
  50. package/es5/jodit.js +79 -29
  51. package/es5/jodit.min.css +2 -2
  52. package/es5/jodit.min.js +2 -2
  53. package/es5/plugins/debug/debug.css +1 -1
  54. package/es5/plugins/debug/debug.js +1 -1
  55. package/es5/plugins/debug/debug.min.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  57. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  58. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  59. package/esm/core/async/async.d.ts +13 -3
  60. package/esm/core/async/async.js +59 -11
  61. package/esm/core/constants.js +1 -1
  62. package/esm/core/dom/lazy-walker.d.ts +4 -3
  63. package/esm/core/dom/lazy-walker.js +14 -12
  64. package/esm/types/async.d.ts +6 -0
  65. package/package.json +1 -1
  66. package/types/core/async/async.d.ts +13 -3
  67. package/types/core/dom/lazy-walker.d.ts +4 -3
  68. package/types/types/async.d.ts +6 -0
  69. package/es5/975.fat.min.js +0 -10
  70. package/es5/975.min.js +0 -10
package/es2021/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.5.8
4
+ * Version: v4.5.11
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -19,7 +19,7 @@
19
19
  return /******/ (function() { // webpackBootstrap
20
20
  /******/ var __webpack_modules__ = ({
21
21
 
22
- /***/ 7865:
22
+ /***/ 52201:
23
23
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
24
24
 
25
25
  "use strict";
@@ -1067,9 +1067,10 @@ class Async {
1067
1067
  this.__queueMicrotaskNative = queueMicrotask?.bind(window) ??
1068
1068
  Promise.resolve().then.bind(Promise.resolve());
1069
1069
  this.promisesRejections = new Set();
1070
- this.requestsIdle = new Set();
1071
- this.requestsRaf = new Set();
1072
- this.requestIdleCallbackNative = window['requestIdleCallback']?.bind(window) ??
1070
+ this.__requestsIdle = new Set();
1071
+ this.__controllers = new Set();
1072
+ this.__requestsRaf = new Set();
1073
+ this.__requestIdleCallbackNative = window['requestIdleCallback']?.bind(window) ??
1073
1074
  ((callback, options) => {
1074
1075
  const start = Date.now();
1075
1076
  return this.setTimeout(() => {
@@ -1299,9 +1300,9 @@ class Async {
1299
1300
  const t = {};
1300
1301
  return Promise.race([p, t]).then(v => (v === t ? 'pending' : 'fulfilled'), () => 'rejected');
1301
1302
  }
1302
- requestIdleCallback(callback, options) {
1303
- const request = this.requestIdleCallbackNative(callback, options);
1304
- this.requestsIdle.add(request);
1303
+ requestIdleCallback(callback, options = { timeout: 100 }) {
1304
+ const request = this.__requestIdleCallbackNative(callback, options);
1305
+ this.__requestsIdle.add(request);
1305
1306
  return request;
1306
1307
  }
1307
1308
  requestIdlePromise(options) {
@@ -1309,22 +1310,69 @@ class Async {
1309
1310
  const request = this.requestIdleCallback(() => res(request), options);
1310
1311
  });
1311
1312
  }
1313
+ /**
1314
+ * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/
1315
+ */
1316
+ schedulerPostTask(task, options = {
1317
+ delay: 0,
1318
+ priority: 'user-visible'
1319
+ }) {
1320
+ const controller = new AbortController();
1321
+ if (options.signal) {
1322
+ options.signal.addEventListener('abort', () => controller.abort());
1323
+ }
1324
+ this.__controllers.add(controller);
1325
+ // @ts-ignore
1326
+ if (typeof globalThis.scheduler !== 'undefined') {
1327
+ const scheduler = globalThis.scheduler;
1328
+ const promise = scheduler.postTask(task, {
1329
+ ...options,
1330
+ signal: controller.signal
1331
+ });
1332
+ promise
1333
+ .finally(() => {
1334
+ this.__controllers.delete(controller);
1335
+ })
1336
+ .catch(() => null);
1337
+ return promise;
1338
+ }
1339
+ return this.promise((resolve, reject) => {
1340
+ const timeout = this.setTimeout(() => {
1341
+ try {
1342
+ resolve(task());
1343
+ }
1344
+ catch (e) {
1345
+ reject(e);
1346
+ }
1347
+ this.__controllers.delete(controller);
1348
+ }, options.delay || 1);
1349
+ controller.signal.addEventListener('abort', () => {
1350
+ this.clearTimeout(timeout);
1351
+ this.__controllers.delete(controller);
1352
+ reject((0,jodit_core_helpers_utils_error_errors_abort_error__WEBPACK_IMPORTED_MODULE_10__/* .abort */ .h)());
1353
+ });
1354
+ });
1355
+ }
1356
+ schedulerYield() {
1357
+ return this.schedulerPostTask(() => { }, { priority: 'user-visible' });
1358
+ }
1312
1359
  cancelIdleCallback(request) {
1313
- this.requestsIdle.delete(request);
1360
+ this.__requestsIdle.delete(request);
1314
1361
  return this.__cancelIdleCallbackNative(request);
1315
1362
  }
1316
1363
  requestAnimationFrame(callback) {
1317
1364
  const request = requestAnimationFrame(callback);
1318
- this.requestsRaf.add(request);
1365
+ this.__requestsRaf.add(request);
1319
1366
  return request;
1320
1367
  }
1321
1368
  cancelAnimationFrame(request) {
1322
- this.requestsRaf.delete(request);
1369
+ this.__requestsRaf.delete(request);
1323
1370
  cancelAnimationFrame(request);
1324
1371
  }
1325
1372
  clear() {
1326
- this.requestsIdle.forEach(key => this.cancelIdleCallback(key));
1327
- this.requestsRaf.forEach(key => this.cancelAnimationFrame(key));
1373
+ this.__requestsIdle.forEach(key => this.cancelIdleCallback(key));
1374
+ this.__requestsRaf.forEach(key => this.cancelAnimationFrame(key));
1375
+ this.__controllers.forEach(controller => controller.abort());
1328
1376
  this.timers.forEach(key => (0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_1__/* .clearTimeout */ .D)(this.timers.get(key)));
1329
1377
  this.timers.clear();
1330
1378
  this.promisesRejections.forEach(reject => reject());
@@ -1743,7 +1791,7 @@ __webpack_require__.r(__webpack_exports__);
1743
1791
  * Released under MIT see LICENSE.txt in the project root for license information.
1744
1792
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1745
1793
  */
1746
- const APP_VERSION = "4.5.8";
1794
+ const APP_VERSION = "4.5.11";
1747
1795
  // prettier-ignore
1748
1796
  const ES = "es2021";
1749
1797
  const IS_ES_MODERN = true;
@@ -2133,7 +2181,7 @@ class Create {
2133
2181
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2134
2182
  /* harmony export */ d: function() { return /* reexport safe */ autobind_decorator__WEBPACK_IMPORTED_MODULE_0__.Ay; }
2135
2183
  /* harmony export */ });
2136
- /* harmony import */ var autobind_decorator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7865);
2184
+ /* harmony import */ var autobind_decorator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52201);
2137
2185
  /*!
2138
2186
  * Jodit Editor (https://xdsoft.net/jodit/)
2139
2187
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -3647,7 +3695,7 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3647
3695
  }
3648
3696
  this.workNodes = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.eachGen(root, !this.options.reverse);
3649
3697
  this.isFinished = false;
3650
- this.startIdleRequest();
3698
+ this._requestStarting();
3651
3699
  return this;
3652
3700
  }
3653
3701
  constructor(async, options = {}) {
@@ -3659,11 +3707,16 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3659
3707
  this.isWorked = false;
3660
3708
  this.isFinished = false;
3661
3709
  this.idleId = 0;
3710
+ this.__schedulerController = null;
3662
3711
  }
3663
- startIdleRequest() {
3664
- this.idleId = this.async.requestIdleCallback(this.workPerform, {
3665
- timeout: this.options.timeout ?? 10
3666
- });
3712
+ _requestStarting() {
3713
+ this.__schedulerController = new AbortController();
3714
+ this.async
3715
+ .schedulerPostTask(this.__workPerform, {
3716
+ delay: this.options.timeout,
3717
+ signal: this.__schedulerController.signal
3718
+ })
3719
+ .catch(() => null);
3667
3720
  }
3668
3721
  break(reason) {
3669
3722
  if (this.isWorked) {
@@ -3688,14 +3741,12 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3688
3741
  super.destruct();
3689
3742
  this.stop();
3690
3743
  }
3691
- workPerform(deadline) {
3744
+ __workPerform() {
3692
3745
  if (this.workNodes) {
3693
3746
  this.isWorked = true;
3694
3747
  let count = 0;
3695
3748
  const chunkSize = this.options.timeoutChunkSize ?? 50;
3696
- while (!this.isFinished &&
3697
- (deadline.timeRemaining() > 0 ||
3698
- (deadline.didTimeout && count <= chunkSize))) {
3749
+ while (!this.isFinished && count <= chunkSize) {
3699
3750
  const item = this.workNodes.next();
3700
3751
  count += 1;
3701
3752
  if (this.visitNode(item.value)) {
@@ -3711,7 +3762,7 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3711
3762
  this.end();
3712
3763
  }
3713
3764
  if (!this.isFinished) {
3714
- this.startIdleRequest();
3765
+ this._requestStarting();
3715
3766
  }
3716
3767
  }
3717
3768
  visitNode(nodeElm) {
@@ -3725,7 +3776,7 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3725
3776
  }
3726
3777
  (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .Cg)([
3727
3778
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
3728
- ], LazyWalker.prototype, "workPerform", null);
3779
+ ], LazyWalker.prototype, "__workPerform", null);
3729
3780
 
3730
3781
 
3731
3782
  /***/ }),
@@ -9781,7 +9832,7 @@ Plugin.requires = [];
9781
9832
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635);
9782
9833
  /* harmony import */ var jodit_core_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64890);
9783
9834
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
9784
- /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7865);
9835
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(52201);
9785
9836
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
9786
9837
  /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(50156);
9787
9838
  /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36115);
@@ -15962,7 +16013,7 @@ class ProgressBar extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_1__/* .
15962
16013
  /* harmony export */ });
15963
16014
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(31635);
15964
16015
  /* harmony import */ var jodit_core_component_statuses__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64567);
15965
- /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(7865);
16016
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(52201);
15966
16017
  /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
15967
16018
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
15968
16019
  /* harmony import */ var jodit_core_helpers_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(32709);