jodit 4.5.9 → 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 (66) 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 +71 -24
  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 +74 -24
  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 +74 -23
  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 +74 -23
  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 +1 -1
  43. package/es5/415.min.js +1 -1
  44. package/es5/5.fat.min.js +1 -1
  45. package/es5/5.min.js +1 -1
  46. package/es5/jodit.css +2 -2
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +73 -24
  49. package/es5/jodit.min.css +2 -2
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.css +1 -1
  52. package/es5/plugins/debug/debug.js +1 -1
  53. package/es5/plugins/debug/debug.min.js +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  57. package/esm/core/async/async.d.ts +13 -3
  58. package/esm/core/async/async.js +58 -10
  59. package/esm/core/constants.js +1 -1
  60. package/esm/core/dom/lazy-walker.d.ts +4 -3
  61. package/esm/core/dom/lazy-walker.js +14 -12
  62. package/esm/types/async.d.ts +6 -0
  63. package/package.json +1 -1
  64. package/types/core/async/async.d.ts +13 -3
  65. package/types/core/dom/lazy-walker.d.ts +4 -3
  66. package/types/types/async.d.ts +6 -0
package/es5/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.9
4
+ * Version: v4.5.11
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1079,9 +1079,10 @@ var Async = /** @class */ (function () {
1079
1079
  this.__callbacks = new Map();
1080
1080
  this.__queueMicrotaskNative = (_a = queueMicrotask === null || queueMicrotask === void 0 ? void 0 : queueMicrotask.bind(window)) !== null && _a !== void 0 ? _a : Promise.resolve().then.bind(Promise.resolve());
1081
1081
  this.promisesRejections = new Set();
1082
- this.requestsIdle = new Set();
1083
- this.requestsRaf = new Set();
1084
- this.requestIdleCallbackNative = (_c = (_b = window['requestIdleCallback']) === null || _b === void 0 ? void 0 : _b.bind(window)) !== null && _c !== void 0 ? _c : (function (callback, options) {
1082
+ this.__requestsIdle = new Set();
1083
+ this.__controllers = new Set();
1084
+ this.__requestsRaf = new Set();
1085
+ this.__requestIdleCallbackNative = (_c = (_b = window['requestIdleCallback']) === null || _b === void 0 ? void 0 : _b.bind(window)) !== null && _c !== void 0 ? _c : (function (callback, options) {
1085
1086
  var _a;
1086
1087
  var start = Date.now();
1087
1088
  return _this.setTimeout(function () {
@@ -1345,8 +1346,8 @@ var Async = /** @class */ (function () {
1345
1346
  };
1346
1347
  Async.prototype.requestIdleCallback = function (callback, options) {
1347
1348
  if (options === void 0) { options = { timeout: 100 }; }
1348
- var request = this.requestIdleCallbackNative(callback, options);
1349
- this.requestsIdle.add(request);
1349
+ var request = this.__requestIdleCallbackNative(callback, options);
1350
+ this.__requestsIdle.add(request);
1350
1351
  return request;
1351
1352
  };
1352
1353
  Async.prototype.requestIdlePromise = function (options) {
@@ -1355,23 +1356,69 @@ var Async = /** @class */ (function () {
1355
1356
  var request = _this.requestIdleCallback(function () { return res(request); }, options);
1356
1357
  });
1357
1358
  };
1359
+ /**
1360
+ * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/
1361
+ */
1362
+ Async.prototype.schedulerPostTask = function (task, options) {
1363
+ var _this = this;
1364
+ if (options === void 0) { options = {
1365
+ delay: 0,
1366
+ priority: 'user-visible'
1367
+ }; }
1368
+ var controller = new AbortController();
1369
+ if (options.signal) {
1370
+ options.signal.addEventListener('abort', function () { return controller.abort(); });
1371
+ }
1372
+ this.__controllers.add(controller);
1373
+ // @ts-ignore
1374
+ if (typeof globalThis.scheduler !== 'undefined') {
1375
+ var scheduler = globalThis.scheduler;
1376
+ var promise = scheduler.postTask(task, (0,tslib__WEBPACK_IMPORTED_MODULE_5__/* .__assign */ .Cl)((0,tslib__WEBPACK_IMPORTED_MODULE_5__/* .__assign */ .Cl)({}, options), { signal: controller.signal }));
1377
+ promise
1378
+ .finally(function () {
1379
+ _this.__controllers.delete(controller);
1380
+ })
1381
+ .catch(function () { return null; });
1382
+ return promise;
1383
+ }
1384
+ return this.promise(function (resolve, reject) {
1385
+ var timeout = _this.setTimeout(function () {
1386
+ try {
1387
+ resolve(task());
1388
+ }
1389
+ catch (e) {
1390
+ reject(e);
1391
+ }
1392
+ _this.__controllers.delete(controller);
1393
+ }, options.delay || 1);
1394
+ controller.signal.addEventListener('abort', function () {
1395
+ _this.clearTimeout(timeout);
1396
+ _this.__controllers.delete(controller);
1397
+ reject((0,jodit_core_helpers_utils_error_errors_abort_error__WEBPACK_IMPORTED_MODULE_11__/* .abort */ .h)());
1398
+ });
1399
+ });
1400
+ };
1401
+ Async.prototype.schedulerYield = function () {
1402
+ return this.schedulerPostTask(function () { }, { priority: 'user-visible' });
1403
+ };
1358
1404
  Async.prototype.cancelIdleCallback = function (request) {
1359
- this.requestsIdle.delete(request);
1405
+ this.__requestsIdle.delete(request);
1360
1406
  return this.__cancelIdleCallbackNative(request);
1361
1407
  };
1362
1408
  Async.prototype.requestAnimationFrame = function (callback) {
1363
1409
  var request = requestAnimationFrame(callback);
1364
- this.requestsRaf.add(request);
1410
+ this.__requestsRaf.add(request);
1365
1411
  return request;
1366
1412
  };
1367
1413
  Async.prototype.cancelAnimationFrame = function (request) {
1368
- this.requestsRaf.delete(request);
1414
+ this.__requestsRaf.delete(request);
1369
1415
  cancelAnimationFrame(request);
1370
1416
  };
1371
1417
  Async.prototype.clear = function () {
1372
1418
  var _this = this;
1373
- this.requestsIdle.forEach(function (key) { return _this.cancelIdleCallback(key); });
1374
- this.requestsRaf.forEach(function (key) { return _this.cancelAnimationFrame(key); });
1419
+ this.__requestsIdle.forEach(function (key) { return _this.cancelIdleCallback(key); });
1420
+ this.__requestsRaf.forEach(function (key) { return _this.cancelAnimationFrame(key); });
1421
+ this.__controllers.forEach(function (controller) { return controller.abort(); });
1375
1422
  this.timers.forEach(function (key) {
1376
1423
  return (0,jodit_core_helpers_async__WEBPACK_IMPORTED_MODULE_1__/* .clearTimeout */ .D)(_this.timers.get(key));
1377
1424
  });
@@ -1850,7 +1897,7 @@ __webpack_require__.r(__webpack_exports__);
1850
1897
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1851
1898
  */
1852
1899
 
1853
- var APP_VERSION = "4.5.9";
1900
+ var APP_VERSION = "4.5.11";
1854
1901
  // prettier-ignore
1855
1902
  var ES = "es5";
1856
1903
  var IS_ES_MODERN = false;
@@ -3894,6 +3941,7 @@ var LazyWalker = /** @class */ (function (_super) {
3894
3941
  _this.isWorked = false;
3895
3942
  _this.isFinished = false;
3896
3943
  _this.idleId = 0;
3944
+ _this.__schedulerController = null;
3897
3945
  return _this;
3898
3946
  }
3899
3947
  LazyWalker.prototype.setWork = function (root) {
@@ -3902,14 +3950,17 @@ var LazyWalker = /** @class */ (function (_super) {
3902
3950
  }
3903
3951
  this.workNodes = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.eachGen(root, !this.options.reverse);
3904
3952
  this.isFinished = false;
3905
- this.startIdleRequest();
3953
+ this._requestStarting();
3906
3954
  return this;
3907
3955
  };
3908
- LazyWalker.prototype.startIdleRequest = function () {
3909
- var _a;
3910
- this.idleId = this.async.requestIdleCallback(this.workPerform, {
3911
- timeout: (_a = this.options.timeout) !== null && _a !== void 0 ? _a : 10
3912
- });
3956
+ LazyWalker.prototype._requestStarting = function () {
3957
+ this.__schedulerController = new AbortController();
3958
+ this.async
3959
+ .schedulerPostTask(this.__workPerform, {
3960
+ delay: this.options.timeout,
3961
+ signal: this.__schedulerController.signal
3962
+ })
3963
+ .catch(function () { return null; });
3913
3964
  };
3914
3965
  LazyWalker.prototype.break = function (reason) {
3915
3966
  if (this.isWorked) {
@@ -3934,15 +3985,13 @@ var LazyWalker = /** @class */ (function (_super) {
3934
3985
  _super.prototype.destruct.call(this);
3935
3986
  this.stop();
3936
3987
  };
3937
- LazyWalker.prototype.workPerform = function (deadline) {
3988
+ LazyWalker.prototype.__workPerform = function () {
3938
3989
  var _a;
3939
3990
  if (this.workNodes) {
3940
3991
  this.isWorked = true;
3941
3992
  var count = 0;
3942
3993
  var chunkSize = (_a = this.options.timeoutChunkSize) !== null && _a !== void 0 ? _a : 50;
3943
- while (!this.isFinished &&
3944
- (deadline.timeRemaining() > 0 ||
3945
- (deadline.didTimeout && count <= chunkSize))) {
3994
+ while (!this.isFinished && count <= chunkSize) {
3946
3995
  var item = this.workNodes.next();
3947
3996
  count += 1;
3948
3997
  if (this.visitNode(item.value)) {
@@ -3958,7 +4007,7 @@ var LazyWalker = /** @class */ (function (_super) {
3958
4007
  this.end();
3959
4008
  }
3960
4009
  if (!this.isFinished) {
3961
- this.startIdleRequest();
4010
+ this._requestStarting();
3962
4011
  }
3963
4012
  };
3964
4013
  LazyWalker.prototype.visitNode = function (nodeElm) {
@@ -3972,7 +4021,7 @@ var LazyWalker = /** @class */ (function (_super) {
3972
4021
  };
3973
4022
  (0,tslib__WEBPACK_IMPORTED_MODULE_3__/* .__decorate */ .Cg)([
3974
4023
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
3975
- ], LazyWalker.prototype, "workPerform", null);
4024
+ ], LazyWalker.prototype, "__workPerform", null);
3976
4025
  return LazyWalker;
3977
4026
  }(jodit_core_event_emitter_eventify__WEBPACK_IMPORTED_MODULE_2__/* .Eventify */ .h));
3978
4027
 
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
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.9
4
+ * Version: v4.5.11
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.5.9
11
+ * Version: v4.5.11
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */