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/es2018/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.__callbacks = new Map();
1068
1068
  this.__queueMicrotaskNative = (_a = queueMicrotask === null || queueMicrotask === void 0 ? void 0 : queueMicrotask.bind(window)) !== null && _a !== void 0 ? _a : 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 = (_c = (_b = window['requestIdleCallback']) === null || _b === void 0 ? void 0 : _b.bind(window)) !== null && _c !== void 0 ? _c : ((callback, options) => {
1070
+ this.__requestsIdle = new Set();
1071
+ this.__controllers = new Set();
1072
+ this.__requestsRaf = new Set();
1073
+ this.__requestIdleCallbackNative = (_c = (_b = window['requestIdleCallback']) === null || _b === void 0 ? void 0 : _b.bind(window)) !== null && _c !== void 0 ? _c : ((callback, options) => {
1073
1074
  var _a;
1074
1075
  const start = Date.now();
1075
1076
  return this.setTimeout(() => {
@@ -1298,9 +1299,9 @@ class Async {
1298
1299
  const t = {};
1299
1300
  return Promise.race([p, t]).then(v => (v === t ? 'pending' : 'fulfilled'), () => 'rejected');
1300
1301
  }
1301
- requestIdleCallback(callback, options) {
1302
- const request = this.requestIdleCallbackNative(callback, options);
1303
- this.requestsIdle.add(request);
1302
+ requestIdleCallback(callback, options = { timeout: 100 }) {
1303
+ const request = this.__requestIdleCallbackNative(callback, options);
1304
+ this.__requestsIdle.add(request);
1304
1305
  return request;
1305
1306
  }
1306
1307
  requestIdlePromise(options) {
@@ -1308,22 +1309,69 @@ class Async {
1308
1309
  const request = this.requestIdleCallback(() => res(request), options);
1309
1310
  });
1310
1311
  }
1312
+ /**
1313
+ * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/
1314
+ */
1315
+ schedulerPostTask(task, options = {
1316
+ delay: 0,
1317
+ priority: 'user-visible'
1318
+ }) {
1319
+ const controller = new AbortController();
1320
+ if (options.signal) {
1321
+ options.signal.addEventListener('abort', () => controller.abort());
1322
+ }
1323
+ this.__controllers.add(controller);
1324
+ // @ts-ignore
1325
+ if (typeof globalThis.scheduler !== 'undefined') {
1326
+ const scheduler = globalThis.scheduler;
1327
+ const promise = scheduler.postTask(task, {
1328
+ ...options,
1329
+ signal: controller.signal
1330
+ });
1331
+ promise
1332
+ .finally(() => {
1333
+ this.__controllers.delete(controller);
1334
+ })
1335
+ .catch(() => null);
1336
+ return promise;
1337
+ }
1338
+ return this.promise((resolve, reject) => {
1339
+ const timeout = this.setTimeout(() => {
1340
+ try {
1341
+ resolve(task());
1342
+ }
1343
+ catch (e) {
1344
+ reject(e);
1345
+ }
1346
+ this.__controllers.delete(controller);
1347
+ }, options.delay || 1);
1348
+ controller.signal.addEventListener('abort', () => {
1349
+ this.clearTimeout(timeout);
1350
+ this.__controllers.delete(controller);
1351
+ reject((0,jodit_core_helpers_utils_error_errors_abort_error__WEBPACK_IMPORTED_MODULE_10__/* .abort */ .h)());
1352
+ });
1353
+ });
1354
+ }
1355
+ schedulerYield() {
1356
+ return this.schedulerPostTask(() => { }, { priority: 'user-visible' });
1357
+ }
1311
1358
  cancelIdleCallback(request) {
1312
- this.requestsIdle.delete(request);
1359
+ this.__requestsIdle.delete(request);
1313
1360
  return this.__cancelIdleCallbackNative(request);
1314
1361
  }
1315
1362
  requestAnimationFrame(callback) {
1316
1363
  const request = requestAnimationFrame(callback);
1317
- this.requestsRaf.add(request);
1364
+ this.__requestsRaf.add(request);
1318
1365
  return request;
1319
1366
  }
1320
1367
  cancelAnimationFrame(request) {
1321
- this.requestsRaf.delete(request);
1368
+ this.__requestsRaf.delete(request);
1322
1369
  cancelAnimationFrame(request);
1323
1370
  }
1324
1371
  clear() {
1325
- this.requestsIdle.forEach(key => this.cancelIdleCallback(key));
1326
- this.requestsRaf.forEach(key => this.cancelAnimationFrame(key));
1372
+ this.__requestsIdle.forEach(key => this.cancelIdleCallback(key));
1373
+ this.__requestsRaf.forEach(key => this.cancelAnimationFrame(key));
1374
+ this.__controllers.forEach(controller => controller.abort());
1327
1375
  this.timers.forEach(key => (0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_1__/* .clearTimeout */ .D)(this.timers.get(key)));
1328
1376
  this.timers.clear();
1329
1377
  this.promisesRejections.forEach(reject => reject());
@@ -1742,7 +1790,7 @@ __webpack_require__.r(__webpack_exports__);
1742
1790
  * Released under MIT see LICENSE.txt in the project root for license information.
1743
1791
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1744
1792
  */
1745
- const APP_VERSION = "4.5.8";
1793
+ const APP_VERSION = "4.5.11";
1746
1794
  // prettier-ignore
1747
1795
  const ES = "es2018";
1748
1796
  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.
@@ -3654,7 +3702,7 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3654
3702
  }
3655
3703
  this.workNodes = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.eachGen(root, !this.options.reverse);
3656
3704
  this.isFinished = false;
3657
- this.startIdleRequest();
3705
+ this._requestStarting();
3658
3706
  return this;
3659
3707
  }
3660
3708
  constructor(async, options = {}) {
@@ -3666,12 +3714,16 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3666
3714
  this.isWorked = false;
3667
3715
  this.isFinished = false;
3668
3716
  this.idleId = 0;
3717
+ this.__schedulerController = null;
3669
3718
  }
3670
- startIdleRequest() {
3671
- var _a;
3672
- this.idleId = this.async.requestIdleCallback(this.workPerform, {
3673
- timeout: (_a = this.options.timeout) !== null && _a !== void 0 ? _a : 10
3674
- });
3719
+ _requestStarting() {
3720
+ this.__schedulerController = new AbortController();
3721
+ this.async
3722
+ .schedulerPostTask(this.__workPerform, {
3723
+ delay: this.options.timeout,
3724
+ signal: this.__schedulerController.signal
3725
+ })
3726
+ .catch(() => null);
3675
3727
  }
3676
3728
  break(reason) {
3677
3729
  if (this.isWorked) {
@@ -3696,15 +3748,13 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3696
3748
  super.destruct();
3697
3749
  this.stop();
3698
3750
  }
3699
- workPerform(deadline) {
3751
+ __workPerform() {
3700
3752
  var _a;
3701
3753
  if (this.workNodes) {
3702
3754
  this.isWorked = true;
3703
3755
  let count = 0;
3704
3756
  const chunkSize = (_a = this.options.timeoutChunkSize) !== null && _a !== void 0 ? _a : 50;
3705
- while (!this.isFinished &&
3706
- (deadline.timeRemaining() > 0 ||
3707
- (deadline.didTimeout && count <= chunkSize))) {
3757
+ while (!this.isFinished && count <= chunkSize) {
3708
3758
  const item = this.workNodes.next();
3709
3759
  count += 1;
3710
3760
  if (this.visitNode(item.value)) {
@@ -3720,7 +3770,7 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3720
3770
  this.end();
3721
3771
  }
3722
3772
  if (!this.isFinished) {
3723
- this.startIdleRequest();
3773
+ this._requestStarting();
3724
3774
  }
3725
3775
  }
3726
3776
  visitNode(nodeElm) {
@@ -3735,7 +3785,7 @@ class LazyWalker extends jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MOD
3735
3785
  }
3736
3786
  (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .Cg)([
3737
3787
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
3738
- ], LazyWalker.prototype, "workPerform", null);
3788
+ ], LazyWalker.prototype, "__workPerform", null);
3739
3789
 
3740
3790
 
3741
3791
  /***/ }),
@@ -9801,7 +9851,7 @@ Plugin.requires = [];
9801
9851
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635);
9802
9852
  /* harmony import */ var jodit_core_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64890);
9803
9853
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
9804
- /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7865);
9854
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(52201);
9805
9855
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
9806
9856
  /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(50156);
9807
9857
  /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36115);
@@ -16013,7 +16063,7 @@ class ProgressBar extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_1__/* .
16013
16063
  /* harmony export */ });
16014
16064
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(31635);
16015
16065
  /* harmony import */ var jodit_core_component_statuses__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64567);
16016
- /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(7865);
16066
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(52201);
16017
16067
  /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
16018
16068
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
16019
16069
  /* harmony import */ var jodit_core_helpers_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(32709);