jodit 4.2.47 → 4.2.49

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 (65) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -0
  3. package/es2015/jodit.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +21 -8
  6. package/es2015/jodit.min.js +2 -2
  7. package/es2015/plugins/debug/debug.css +1 -1
  8. package/es2015/plugins/debug/debug.js +1 -1
  9. package/es2015/plugins/debug/debug.min.js +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  13. package/es2018/jodit.css +1 -1
  14. package/es2018/jodit.fat.min.js +2 -2
  15. package/es2018/jodit.js +21 -8
  16. package/es2018/jodit.min.js +2 -2
  17. package/es2018/plugins/debug/debug.css +1 -1
  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 +1 -1
  24. package/es2021/jodit.fat.min.js +2 -2
  25. package/es2021/jodit.js +21 -8
  26. package/es2021/jodit.min.js +2 -2
  27. package/es2021/plugins/debug/debug.css +1 -1
  28. package/es2021/plugins/debug/debug.js +1 -1
  29. package/es2021/plugins/debug/debug.min.js +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  33. package/es2021.en/jodit.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +2 -2
  35. package/es2021.en/jodit.js +21 -8
  36. package/es2021.en/jodit.min.js +2 -2
  37. package/es2021.en/plugins/debug/debug.css +1 -1
  38. package/es2021.en/plugins/debug/debug.js +1 -1
  39. package/es2021.en/plugins/debug/debug.min.js +1 -1
  40. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  43. package/es5/164.fat.min.js +1 -1
  44. package/es5/164.min.js +1 -1
  45. package/es5/5.fat.min.js +1 -1
  46. package/es5/5.min.js +1 -1
  47. package/es5/jodit.css +2 -2
  48. package/es5/jodit.fat.min.js +2 -2
  49. package/es5/jodit.js +24 -10
  50. package/es5/jodit.min.css +2 -2
  51. package/es5/jodit.min.js +2 -2
  52. package/es5/plugins/debug/debug.css +1 -1
  53. package/es5/plugins/debug/debug.js +1 -1
  54. package/es5/plugins/debug/debug.min.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  57. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  58. package/esm/core/constants.js +1 -1
  59. package/esm/jodit.d.ts +3 -3
  60. package/esm/plugins/size/size.js +10 -3
  61. package/esm/plugins/source/editor/engines/ace.js +9 -3
  62. package/esm/types/types.d.ts +3 -0
  63. package/package.json +1 -1
  64. package/types/jodit.d.ts +3 -3
  65. package/types/types/types.d.ts +3 -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.2.47
4
+ * Version: v4.2.49
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.2.47
4
+ * Version: v4.2.49
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.2.47
4
+ * Version: v4.2.49
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.2.47
4
+ * Version: v4.2.49
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.2.47
4
+ * Version: v4.2.49
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.2.47
4
+ * Version: v4.2.49
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.2.47";
6
+ export const APP_VERSION = "4.2.49";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
package/esm/jodit.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @packageDocumentation
9
9
  * @module jodit
10
10
  */
11
- import type { AjaxOptions, CanPromise, CustomCommand, ICreate, IDictionary, IFileBrowser, IHistory, IJodit, IMessages, IPluginSystem, IResponse, IStatusBar, IUploader, IWorkPlace, Modes } from "./types";
11
+ import type { AjaxOptions, CanPromise, CustomCommand, DeepPartial, ICreate, IDictionary, IFileBrowser, IHistory, IJodit, IMessages, IPluginSystem, IResponse, IStatusBar, IUploader, IWorkPlace, Modes } from "./types";
12
12
  import type * as Modules from "./modules";
13
13
  import * as constants from "./core/constants";
14
14
  import { Dlgs } from "./core/traits/dlgs";
@@ -65,7 +65,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
65
65
  /**
66
66
  * Factory for creating Jodit instance
67
67
  */
68
- static make(element: HTMLElement | string, options?: object): Jodit;
68
+ static make(element: HTMLElement | string, options?: DeepPartial<Config>): Jodit;
69
69
  /**
70
70
  * Checks if the element has already been initialized when for Jodit
71
71
  */
@@ -341,7 +341,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
341
341
  * @param element - Selector or HTMLElement
342
342
  * @param options - Editor's options
343
343
  */
344
- protected constructor(element: HTMLElement | string, options?: object);
344
+ protected constructor(element: HTMLElement | string, options?: DeepPartial<Config>);
345
345
  currentPlace: IWorkPlace;
346
346
  places: IWorkPlace[];
347
347
  private readonly __elementToPlace;
@@ -76,6 +76,7 @@ let size = class size extends Plugin {
76
76
  * Manually change height
77
77
  */
78
78
  __setHeight(height) {
79
+ const { clientHeight, clientWidth } = this.j.container;
79
80
  if (isNumber(height)) {
80
81
  const { minHeight, maxHeight } = this.j.o;
81
82
  if (isNumber(minHeight) && minHeight > height) {
@@ -89,12 +90,13 @@ let size = class size extends Plugin {
89
90
  if (this.j.o.saveHeightInStorage) {
90
91
  this.j.storage.set('height', height);
91
92
  }
92
- this.__resizeWorkspaceImd();
93
+ this.__resizeWorkspaceImd({ clientHeight, clientWidth });
93
94
  }
94
95
  /**
95
96
  * Manually change width
96
97
  */
97
98
  __setWidth(width) {
99
+ const { clientHeight, clientWidth } = this.j.container;
98
100
  if (isNumber(width)) {
99
101
  const { minWidth, maxWidth } = this.j.o;
100
102
  if (isNumber(minWidth) && minWidth > width) {
@@ -105,7 +107,7 @@ let size = class size extends Plugin {
105
107
  }
106
108
  }
107
109
  css(this.j.container, 'width', width);
108
- this.__resizeWorkspaceImd();
110
+ this.__resizeWorkspaceImd({ clientHeight, clientWidth });
109
111
  }
110
112
  /**
111
113
  * Returns service spaces: toolbar + statusbar
@@ -118,7 +120,7 @@ let size = class size extends Plugin {
118
120
  /**
119
121
  * Calculate workspace height
120
122
  */
121
- __resizeWorkspaceImd() {
123
+ __resizeWorkspaceImd({ clientHeight, clientWidth } = this.j.container) {
122
124
  if (!this.j || this.j.isDestructed || !this.j.o || this.j.o.inline) {
123
125
  return;
124
126
  }
@@ -145,6 +147,11 @@ let size = class size extends Plugin {
145
147
  ? this.j.container.offsetHeight - this.__getNotWorkHeight()
146
148
  : 'auto');
147
149
  }
150
+ const { clientHeight: newClientHeight, clientWidth: newClientWidth } = this.j.container;
151
+ if (clientHeight !== newClientHeight ||
152
+ clientWidth !== newClientWidth) {
153
+ this.j.e.fire(this.j, 'resize');
154
+ }
148
155
  }
149
156
  /** @override **/
150
157
  beforeDestruct(jodit) {
@@ -99,10 +99,12 @@ export class AceEditor extends SourceEditor {
99
99
  if (editor.getRealMode() !== constants.MODE_WYSIWYG) {
100
100
  this.setValue(this.getValue());
101
101
  }
102
- const onResize = this.j.async.debounce(() => {
103
- if (editor.isInDestruct) {
102
+ const onResize = this.j.async.throttle(() => {
103
+ if (editor.isInDestruct ||
104
+ editor.getMode() === constants.MODE_WYSIWYG) {
104
105
  return;
105
106
  }
107
+ const hasFocus = this.instance.isFocused();
106
108
  if (editor.o.height !== 'auto') {
107
109
  this.instance.setOption('maxLines', editor.workplace.offsetHeight /
108
110
  this.instance.renderer.lineHeight);
@@ -111,8 +113,11 @@ export class AceEditor extends SourceEditor {
111
113
  this.instance.setOption('maxLines', Infinity);
112
114
  }
113
115
  this.instance.resize();
116
+ hasFocus && this.focus();
114
117
  }, this.j.defaultTimeout * 2);
115
- editor.e.on('afterResize afterSetMode', onResize);
118
+ editor.e
119
+ .on(editor, 'resize', onResize)
120
+ .on('afterResize afterSetMode', onResize);
116
121
  onResize();
117
122
  this.onReady();
118
123
  };
@@ -163,6 +168,7 @@ export class AceEditor extends SourceEditor {
163
168
  return this.instance.isFocused();
164
169
  }
165
170
  focus() {
171
+ this.instance.container.focus();
166
172
  this.instance.focus();
167
173
  }
168
174
  blur() {
@@ -221,3 +221,6 @@ export interface FuzzySearch {
221
221
  number
222
222
  ];
223
223
  }
224
+ export type DeepPartial<T> = T extends object ? {
225
+ [P in keyof T]?: DeepPartial<T[P]>;
226
+ } : T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.2.47",
3
+ "version": "4.2.49",
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",
package/types/jodit.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @packageDocumentation
9
9
  * @module jodit
10
10
  */
11
- import type { AjaxOptions, CanPromise, CustomCommand, ICreate, IDictionary, IFileBrowser, IHistory, IJodit, IMessages, IPluginSystem, IResponse, IStatusBar, IUploader, IWorkPlace, Modes } from "./types";
11
+ import type { AjaxOptions, CanPromise, CustomCommand, DeepPartial, ICreate, IDictionary, IFileBrowser, IHistory, IJodit, IMessages, IPluginSystem, IResponse, IStatusBar, IUploader, IWorkPlace, Modes } from "./types";
12
12
  import type * as Modules from "./modules";
13
13
  import * as constants from "./core/constants";
14
14
  import { Dlgs } from "./core/traits/dlgs";
@@ -65,7 +65,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
65
65
  /**
66
66
  * Factory for creating Jodit instance
67
67
  */
68
- static make(element: HTMLElement | string, options?: object): Jodit;
68
+ static make(element: HTMLElement | string, options?: DeepPartial<Config>): Jodit;
69
69
  /**
70
70
  * Checks if the element has already been initialized when for Jodit
71
71
  */
@@ -341,7 +341,7 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
341
341
  * @param element - Selector or HTMLElement
342
342
  * @param options - Editor's options
343
343
  */
344
- protected constructor(element: HTMLElement | string, options?: object);
344
+ protected constructor(element: HTMLElement | string, options?: DeepPartial<Config>);
345
345
  currentPlace: IWorkPlace;
346
346
  places: IWorkPlace[];
347
347
  private readonly __elementToPlace;
@@ -221,3 +221,6 @@ export interface FuzzySearch {
221
221
  number
222
222
  ];
223
223
  }
224
+ export type DeepPartial<T> = T extends object ? {
225
+ [P in keyof T]?: DeepPartial<T[P]>;
226
+ } : T;