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
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -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
  */
@@ -53,9 +53,10 @@ export declare class Async implements IAsync {
53
53
  * Get Promise status
54
54
  */
55
55
  promiseState(p: Promise<any>): Promise<'pending' | 'fulfilled' | 'rejected'>;
56
- private requestsIdle;
57
- private requestsRaf;
58
- private requestIdleCallbackNative;
56
+ private __requestsIdle;
57
+ private __controllers;
58
+ private __requestsRaf;
59
+ private __requestIdleCallbackNative;
59
60
  private __cancelIdleCallbackNative;
60
61
  requestIdleCallback(callback: IdleRequestCallback, options?: {
61
62
  timeout: number;
@@ -63,6 +64,15 @@ export declare class Async implements IAsync {
63
64
  requestIdlePromise(options?: {
64
65
  timeout: number;
65
66
  }): RejectablePromise<number>;
67
+ /**
68
+ * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/
69
+ */
70
+ schedulerPostTask<T = void>(task: () => T, options?: {
71
+ signal?: AbortSignal;
72
+ delay?: number;
73
+ priority?: 'background' | 'user-blocking' | 'user-visible';
74
+ }): Promise<T>;
75
+ schedulerYield(): Promise<void>;
66
76
  cancelIdleCallback(request: number): void;
67
77
  requestAnimationFrame(callback: FrameRequestCallback): number;
68
78
  cancelAnimationFrame(request: number): void;
@@ -21,9 +21,10 @@ export class Async {
21
21
  this.__callbacks = new Map();
22
22
  this.__queueMicrotaskNative = (_a = queueMicrotask === null || queueMicrotask === void 0 ? void 0 : queueMicrotask.bind(window)) !== null && _a !== void 0 ? _a : Promise.resolve().then.bind(Promise.resolve());
23
23
  this.promisesRejections = new Set();
24
- this.requestsIdle = new Set();
25
- this.requestsRaf = new Set();
26
- this.requestIdleCallbackNative = (_c = (_b = window['requestIdleCallback']) === null || _b === void 0 ? void 0 : _b.bind(window)) !== null && _c !== void 0 ? _c : ((callback, options) => {
24
+ this.__requestsIdle = new Set();
25
+ this.__controllers = new Set();
26
+ this.__requestsRaf = new Set();
27
+ this.__requestIdleCallbackNative = (_c = (_b = window['requestIdleCallback']) === null || _b === void 0 ? void 0 : _b.bind(window)) !== null && _c !== void 0 ? _c : ((callback, options) => {
27
28
  var _a;
28
29
  const start = Date.now();
29
30
  return this.setTimeout(() => {
@@ -253,8 +254,8 @@ export class Async {
253
254
  return Promise.race([p, t]).then(v => (v === t ? 'pending' : 'fulfilled'), () => 'rejected');
254
255
  }
255
256
  requestIdleCallback(callback, options = { timeout: 100 }) {
256
- const request = this.requestIdleCallbackNative(callback, options);
257
- this.requestsIdle.add(request);
257
+ const request = this.__requestIdleCallbackNative(callback, options);
258
+ this.__requestsIdle.add(request);
258
259
  return request;
259
260
  }
260
261
  requestIdlePromise(options) {
@@ -262,22 +263,69 @@ export class Async {
262
263
  const request = this.requestIdleCallback(() => res(request), options);
263
264
  });
264
265
  }
266
+ /**
267
+ * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/
268
+ */
269
+ schedulerPostTask(task, options = {
270
+ delay: 0,
271
+ priority: 'user-visible'
272
+ }) {
273
+ const controller = new AbortController();
274
+ if (options.signal) {
275
+ options.signal.addEventListener('abort', () => controller.abort());
276
+ }
277
+ this.__controllers.add(controller);
278
+ // @ts-ignore
279
+ if (typeof globalThis.scheduler !== 'undefined') {
280
+ const scheduler = globalThis.scheduler;
281
+ const promise = scheduler.postTask(task, {
282
+ ...options,
283
+ signal: controller.signal
284
+ });
285
+ promise
286
+ .finally(() => {
287
+ this.__controllers.delete(controller);
288
+ })
289
+ .catch(() => null);
290
+ return promise;
291
+ }
292
+ return this.promise((resolve, reject) => {
293
+ const timeout = this.setTimeout(() => {
294
+ try {
295
+ resolve(task());
296
+ }
297
+ catch (e) {
298
+ reject(e);
299
+ }
300
+ this.__controllers.delete(controller);
301
+ }, options.delay || 1);
302
+ controller.signal.addEventListener('abort', () => {
303
+ this.clearTimeout(timeout);
304
+ this.__controllers.delete(controller);
305
+ reject(abort());
306
+ });
307
+ });
308
+ }
309
+ schedulerYield() {
310
+ return this.schedulerPostTask(() => { }, { priority: 'user-visible' });
311
+ }
265
312
  cancelIdleCallback(request) {
266
- this.requestsIdle.delete(request);
313
+ this.__requestsIdle.delete(request);
267
314
  return this.__cancelIdleCallbackNative(request);
268
315
  }
269
316
  requestAnimationFrame(callback) {
270
317
  const request = requestAnimationFrame(callback);
271
- this.requestsRaf.add(request);
318
+ this.__requestsRaf.add(request);
272
319
  return request;
273
320
  }
274
321
  cancelAnimationFrame(request) {
275
- this.requestsRaf.delete(request);
322
+ this.__requestsRaf.delete(request);
276
323
  cancelAnimationFrame(request);
277
324
  }
278
325
  clear() {
279
- this.requestsIdle.forEach(key => this.cancelIdleCallback(key));
280
- this.requestsRaf.forEach(key => this.cancelAnimationFrame(key));
326
+ this.__requestsIdle.forEach(key => this.cancelIdleCallback(key));
327
+ this.__requestsRaf.forEach(key => this.cancelAnimationFrame(key));
328
+ this.__controllers.forEach(controller => controller.abort());
281
329
  this.timers.forEach(key => clearTimeout(this.timers.get(key)));
282
330
  this.timers.clear();
283
331
  this.promisesRejections.forEach(reject => reject());
@@ -3,7 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export const APP_VERSION = "4.5.9";
6
+ export const APP_VERSION = "4.5.11";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -21,17 +21,18 @@ export declare class LazyWalker extends Eventify<{
21
21
  private isWorked;
22
22
  private isFinished;
23
23
  constructor(async: IAsync, options?: {
24
- readonly timeout?: number;
25
24
  readonly whatToShow?: number;
26
25
  readonly reverse?: boolean;
27
26
  readonly timeoutChunkSize?: number;
27
+ readonly timeout?: number;
28
28
  });
29
29
  private idleId;
30
- private startIdleRequest;
30
+ private __schedulerController;
31
+ private _requestStarting;
31
32
  break(reason?: string): void;
32
33
  end(): void;
33
34
  private stop;
34
35
  destruct(): void;
35
- private workPerform;
36
+ private __workPerform;
36
37
  private visitNode;
37
38
  }
@@ -23,7 +23,7 @@ export class LazyWalker extends Eventify {
23
23
  }
24
24
  this.workNodes = Dom.eachGen(root, !this.options.reverse);
25
25
  this.isFinished = false;
26
- this.startIdleRequest();
26
+ this._requestStarting();
27
27
  return this;
28
28
  }
29
29
  constructor(async, options = {}) {
@@ -35,12 +35,16 @@ export class LazyWalker extends Eventify {
35
35
  this.isWorked = false;
36
36
  this.isFinished = false;
37
37
  this.idleId = 0;
38
+ this.__schedulerController = null;
38
39
  }
39
- startIdleRequest() {
40
- var _a;
41
- this.idleId = this.async.requestIdleCallback(this.workPerform, {
42
- timeout: (_a = this.options.timeout) !== null && _a !== void 0 ? _a : 10
43
- });
40
+ _requestStarting() {
41
+ this.__schedulerController = new AbortController();
42
+ this.async
43
+ .schedulerPostTask(this.__workPerform, {
44
+ delay: this.options.timeout,
45
+ signal: this.__schedulerController.signal
46
+ })
47
+ .catch(() => null);
44
48
  }
45
49
  break(reason) {
46
50
  if (this.isWorked) {
@@ -65,15 +69,13 @@ export class LazyWalker extends Eventify {
65
69
  super.destruct();
66
70
  this.stop();
67
71
  }
68
- workPerform(deadline) {
72
+ __workPerform() {
69
73
  var _a;
70
74
  if (this.workNodes) {
71
75
  this.isWorked = true;
72
76
  let count = 0;
73
77
  const chunkSize = (_a = this.options.timeoutChunkSize) !== null && _a !== void 0 ? _a : 50;
74
- while (!this.isFinished &&
75
- (deadline.timeRemaining() > 0 ||
76
- (deadline.didTimeout && count <= chunkSize))) {
78
+ while (!this.isFinished && count <= chunkSize) {
77
79
  const item = this.workNodes.next();
78
80
  count += 1;
79
81
  if (this.visitNode(item.value)) {
@@ -89,7 +91,7 @@ export class LazyWalker extends Eventify {
89
91
  this.end();
90
92
  }
91
93
  if (!this.isFinished) {
92
- this.startIdleRequest();
94
+ this._requestStarting();
93
95
  }
94
96
  }
95
97
  visitNode(nodeElm) {
@@ -104,4 +106,4 @@ export class LazyWalker extends Eventify {
104
106
  }
105
107
  __decorate([
106
108
  autobind
107
- ], LazyWalker.prototype, "workPerform", null);
109
+ ], LazyWalker.prototype, "__workPerform", null);
@@ -38,6 +38,12 @@ export interface IAsync extends IDestructible {
38
38
  timeout: number;
39
39
  }): RejectablePromise<number>;
40
40
  cancelIdleCallback(request: number): void;
41
+ schedulerPostTask<T = void>(task: () => T, options: {
42
+ delay?: number;
43
+ priority?: 'background' | 'user-blocking' | 'user-visible';
44
+ signal?: AbortSignal;
45
+ }): Promise<T>;
46
+ schedulerYield(): Promise<void>;
41
47
  /**
42
48
  * Smart wrapper for `requestAnimationFrame`
43
49
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.5.9",
3
+ "version": "4.5.11",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",
@@ -53,9 +53,10 @@ export declare class Async implements IAsync {
53
53
  * Get Promise status
54
54
  */
55
55
  promiseState(p: Promise<any>): Promise<'pending' | 'fulfilled' | 'rejected'>;
56
- private requestsIdle;
57
- private requestsRaf;
58
- private requestIdleCallbackNative;
56
+ private __requestsIdle;
57
+ private __controllers;
58
+ private __requestsRaf;
59
+ private __requestIdleCallbackNative;
59
60
  private __cancelIdleCallbackNative;
60
61
  requestIdleCallback(callback: IdleRequestCallback, options?: {
61
62
  timeout: number;
@@ -63,6 +64,15 @@ export declare class Async implements IAsync {
63
64
  requestIdlePromise(options?: {
64
65
  timeout: number;
65
66
  }): RejectablePromise<number>;
67
+ /**
68
+ * Try to use scheduler.postTask if it is available https://wicg.github.io/scheduling-apis/
69
+ */
70
+ schedulerPostTask<T = void>(task: () => T, options?: {
71
+ signal?: AbortSignal;
72
+ delay?: number;
73
+ priority?: 'background' | 'user-blocking' | 'user-visible';
74
+ }): Promise<T>;
75
+ schedulerYield(): Promise<void>;
66
76
  cancelIdleCallback(request: number): void;
67
77
  requestAnimationFrame(callback: FrameRequestCallback): number;
68
78
  cancelAnimationFrame(request: number): void;
@@ -21,17 +21,18 @@ export declare class LazyWalker extends Eventify<{
21
21
  private isWorked;
22
22
  private isFinished;
23
23
  constructor(async: IAsync, options?: {
24
- readonly timeout?: number;
25
24
  readonly whatToShow?: number;
26
25
  readonly reverse?: boolean;
27
26
  readonly timeoutChunkSize?: number;
27
+ readonly timeout?: number;
28
28
  });
29
29
  private idleId;
30
- private startIdleRequest;
30
+ private __schedulerController;
31
+ private _requestStarting;
31
32
  break(reason?: string): void;
32
33
  end(): void;
33
34
  private stop;
34
35
  destruct(): void;
35
- private workPerform;
36
+ private __workPerform;
36
37
  private visitNode;
37
38
  }
@@ -38,6 +38,12 @@ export interface IAsync extends IDestructible {
38
38
  timeout: number;
39
39
  }): RejectablePromise<number>;
40
40
  cancelIdleCallback(request: number): void;
41
+ schedulerPostTask<T = void>(task: () => T, options: {
42
+ delay?: number;
43
+ priority?: 'background' | 'user-blocking' | 'user-visible';
44
+ signal?: AbortSignal;
45
+ }): Promise<T>;
46
+ schedulerYield(): Promise<void>;
41
47
  /**
42
48
  * Smart wrapper for `requestAnimationFrame`
43
49
  */