jodit 4.1.12 → 4.1.16

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 (64) hide show
  1. package/es2015/jodit.css +2 -1
  2. package/es2015/jodit.fat.min.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +81 -61
  5. package/es2015/jodit.min.css +1 -1
  6. package/es2015/jodit.min.js +2 -2
  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 +2 -1
  13. package/es2018/jodit.fat.min.css +1 -1
  14. package/es2018/jodit.fat.min.js +2 -2
  15. package/es2018/jodit.js +80 -60
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +2 -2
  18. package/es2018/plugins/debug/debug.js +1 -1
  19. package/es2018/plugins/debug/debug.min.js +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  22. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  23. package/es2021/jodit.css +2 -1
  24. package/es2021/jodit.fat.min.css +1 -1
  25. package/es2021/jodit.fat.min.js +2 -2
  26. package/es2021/jodit.js +79 -60
  27. package/es2021/jodit.min.css +1 -1
  28. package/es2021/jodit.min.js +2 -2
  29. package/es2021/plugins/debug/debug.js +1 -1
  30. package/es2021/plugins/debug/debug.min.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  33. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  34. package/es2021.en/jodit.css +2 -1
  35. package/es2021.en/jodit.fat.min.css +1 -1
  36. package/es2021.en/jodit.fat.min.js +2 -2
  37. package/es2021.en/jodit.js +79 -60
  38. package/es2021.en/jodit.min.css +1 -1
  39. package/es2021.en/jodit.min.js +2 -2
  40. package/es2021.en/plugins/debug/debug.js +1 -1
  41. package/es2021.en/plugins/debug/debug.min.js +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  45. package/es5/jodit.css +3 -2
  46. package/es5/jodit.fat.min.css +1 -1
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +91 -63
  49. package/es5/jodit.min.css +3 -3
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/esm/core/constants.js +1 -1
  57. package/esm/core/decorators/cache/cache.d.ts +2 -1
  58. package/esm/core/decorators/cache/cache.js +7 -0
  59. package/esm/core/ui/button/tooltip/tooltip.js +2 -4
  60. package/esm/plugins/ai-assistant/ai-assistant.d.ts +2 -0
  61. package/esm/plugins/ai-assistant/ai-assistant.js +39 -28
  62. package/package.json +1 -1
  63. package/types/core/decorators/cache/cache.d.ts +2 -1
  64. package/types/plugins/ai-assistant/ai-assistant.d.ts +2 -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.1.12
4
+ * Version: v4.1.16
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.1.12
4
+ * Version: v4.1.16
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.1.12
4
+ * Version: v4.1.16
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.1.12
4
+ * Version: v4.1.16
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.1.12
4
+ * Version: v4.1.16
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3,7 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export const APP_VERSION = "4.1.12";
6
+ export const APP_VERSION = "4.1.16";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -8,9 +8,10 @@
8
8
  * @packageDocumentation
9
9
  * @module decorators/cache
10
10
  */
11
- import type { IDictionary } from "jodit/esm/types";
11
+ import type { IDictionary, Nullable } from "jodit/esm/types";
12
12
  export interface CachePropertyDescriptor<T, R> extends PropertyDescriptor {
13
13
  get?: (this: T) => R;
14
14
  }
15
+ export declare function cached<T>(object: object, property: string): Nullable<T>;
15
16
  export declare function cache<T, R>(_: object, name: PropertyKey, descriptor: CachePropertyDescriptor<T, R>): void;
16
17
  export declare function cacheHTML<T extends Function, R>(target: IDictionary, _: string, descriptor: CachePropertyDescriptor<T, R>): void;
@@ -7,6 +7,13 @@ import { STATUSES } from "jodit/esm/core/component/statuses.js";
7
7
  import { Dom } from "jodit/esm/core/dom/dom.js";
8
8
  import { isFunction, isViewObject } from "jodit/esm/core/helpers/checker/index.js";
9
9
  import { error } from "jodit/esm/core/helpers/utils/error/error.js";
10
+ export function cached(object, property) {
11
+ const descriptor = Object.getOwnPropertyDescriptor(object, property);
12
+ if (!descriptor || isFunction(descriptor.get)) {
13
+ return null;
14
+ }
15
+ return descriptor.value;
16
+ }
10
17
  export function cache(_, name, descriptor) {
11
18
  const getter = descriptor.get;
12
19
  if (!getter) {
@@ -39,7 +39,8 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
39
39
  view.o.showTooltip &&
40
40
  !view.o.useNativeTooltip) {
41
41
  view.hookStatus(STATUSES.ready, () => {
42
- getContainer(view, UITooltip_1).appendChild(this.container);
42
+ // TODO Move it inside __open method. Now it is here becous testcase failed with capturing
43
+ getContainer(this.j, UITooltip_1).appendChild(this.container);
43
44
  view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
44
45
  capture: true
45
46
  });
@@ -168,9 +169,6 @@ __decorate([
168
169
  __decorate([
169
170
  autobind
170
171
  ], UITooltip.prototype, "__onMouseEnter", null);
171
- __decorate([
172
- autobind
173
- ], UITooltip.prototype, "__delayOpen", null);
174
172
  __decorate([
175
173
  autobind
176
174
  ], UITooltip.prototype, "__hide", null);
@@ -17,6 +17,8 @@ import "./config";
17
17
  export declare class aiAssistant extends Plugin {
18
18
  /** @override */
19
19
  buttons: Plugin['buttons'];
20
+ private get __dialog();
21
+ private get __container();
20
22
  constructor(jodit: IJodit);
21
23
  /** @override */
22
24
  afterInit(jodit: IJodit): void;
@@ -13,6 +13,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
13
13
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
14
  return c > 3 && r && Object.defineProperty(target, key, r), r;
15
15
  };
16
+ import { cache, cached } from "jodit/esm/core/decorators/cache/cache.js";
16
17
  import { watch } from "jodit/esm/core/decorators/watch/watch.js";
17
18
  import { extendLang, pluginSystem } from "jodit/esm/core/global.js";
18
19
  import { isAbortError } from "jodit/esm/core/helpers/checker/is-abort-error.js";
@@ -24,6 +25,32 @@ import * as langs from "./langs";
24
25
  * The plugin inserts content generated by AI into the editor.
25
26
  */
26
27
  export class aiAssistant extends Plugin {
28
+ get __dialog() {
29
+ return this.jodit.dlg({
30
+ buttons: ['fullsize', 'dialog.close'],
31
+ closeOnClickOverlay: true,
32
+ closeOnEsc: true,
33
+ resizable: false,
34
+ draggable: true,
35
+ minHeight: 160
36
+ });
37
+ }
38
+ get __container() {
39
+ const { jodit, __dialog } = this;
40
+ return new UiAiAssistant(jodit, {
41
+ onInsertAfter(html) {
42
+ jodit.s.focus();
43
+ jodit.s.setCursorAfter(jodit.s.current());
44
+ jodit.s.insertHTML(html);
45
+ __dialog.close();
46
+ },
47
+ onInsert(html) {
48
+ jodit.s.focus();
49
+ jodit.s.insertHTML(html);
50
+ __dialog.close();
51
+ }
52
+ });
53
+ }
27
54
  constructor(jodit) {
28
55
  super(jodit);
29
56
  /** @override */
@@ -42,33 +69,8 @@ export class aiAssistant extends Plugin {
42
69
  /** @override */
43
70
  afterInit(jodit) { }
44
71
  onGenerateAiAssistantForm(prompt) {
45
- const { jodit } = this;
46
- const dialog = jodit.dlg({
47
- buttons: ['fullsize', 'dialog.close'],
48
- closeOnClickOverlay: true,
49
- closeOnEsc: true,
50
- resizable: false,
51
- draggable: true
52
- // minWidth: 460,
53
- // maxWidth: 460
54
- });
55
- dialog.bindDestruct(jodit);
56
- const container = new UiAiAssistant(jodit, {
57
- onInsertAfter(html) {
58
- jodit.s.focus();
59
- jodit.s.setCursorAfter(jodit.s.current());
60
- jodit.s.insertHTML(html);
61
- dialog.close();
62
- },
63
- onInsert(html) {
64
- jodit.s.focus();
65
- jodit.s.insertHTML(html);
66
- dialog.close();
67
- }
68
- });
69
- container.bindDestruct(dialog);
70
- dialog.open(container, 'AI Assistant', true, false);
71
- container.setPrompt(prompt);
72
+ this.__dialog.open(this.__container, 'AI Assistant');
73
+ this.__container.setPrompt(prompt);
72
74
  }
73
75
  onInvokeAiAssistant(prompt) {
74
76
  const { jodit } = this;
@@ -97,8 +99,17 @@ export class aiAssistant extends Plugin {
97
99
  });
98
100
  }
99
101
  /** @override */
100
- beforeDestruct(_) { }
102
+ beforeDestruct(_) {
103
+ cached(this, '__container')?.destruct();
104
+ cached(this, '__dialog')?.destruct();
105
+ }
101
106
  }
107
+ __decorate([
108
+ cache
109
+ ], aiAssistant.prototype, "__dialog", null);
110
+ __decorate([
111
+ cache
112
+ ], aiAssistant.prototype, "__container", null);
102
113
  __decorate([
103
114
  watch(':generateAiAssistantForm.ai-assistant')
104
115
  ], aiAssistant.prototype, "onGenerateAiAssistantForm", null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.1.12",
3
+ "version": "4.1.16",
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",
@@ -8,9 +8,10 @@
8
8
  * @packageDocumentation
9
9
  * @module decorators/cache
10
10
  */
11
- import type { IDictionary } from "jodit/esm/types";
11
+ import type { IDictionary, Nullable } from "jodit/esm/types";
12
12
  export interface CachePropertyDescriptor<T, R> extends PropertyDescriptor {
13
13
  get?: (this: T) => R;
14
14
  }
15
+ export declare function cached<T>(object: object, property: string): Nullable<T>;
15
16
  export declare function cache<T, R>(_: object, name: PropertyKey, descriptor: CachePropertyDescriptor<T, R>): void;
16
17
  export declare function cacheHTML<T extends Function, R>(target: IDictionary, _: string, descriptor: CachePropertyDescriptor<T, R>): void;
@@ -17,6 +17,8 @@ import "./config";
17
17
  export declare class aiAssistant extends Plugin {
18
18
  /** @override */
19
19
  buttons: Plugin['buttons'];
20
+ private get __dialog();
21
+ private get __container();
20
22
  constructor(jodit: IJodit);
21
23
  /** @override */
22
24
  afterInit(jodit: IJodit): void;