jodit 4.11.3 → 4.11.5

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 (72) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/es2015/jodit.css +21 -3
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +14 -14
  5. package/es2015/jodit.js +97 -22
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +5 -5
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +7 -7
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +14 -14
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +21 -3
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +8 -8
  23. package/es2021/jodit.js +96 -21
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +6 -6
  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 +21 -3
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +7 -7
  35. package/es2021.en/jodit.js +96 -21
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +6 -6
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +29 -6
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +112 -28
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  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/es5/polyfills.fat.min.js +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/core/constants.js +1 -1
  60. package/esm/core/ui/button/button/button.js +2 -1
  61. package/esm/core/ui/icon.js +5 -2
  62. package/esm/core/ui/progress-bar/progress-bar.d.ts +9 -0
  63. package/esm/core/ui/progress-bar/progress-bar.js +53 -0
  64. package/esm/modules/toolbar/button/button.d.ts +1 -0
  65. package/esm/modules/toolbar/button/button.js +29 -19
  66. package/esm/types/toolbar.d.ts +12 -2
  67. package/esm/types/ui.d.ts +1 -0
  68. package/package.json +1 -1
  69. package/types/core/ui/progress-bar/progress-bar.d.ts +9 -0
  70. package/types/modules/toolbar/button/button.d.ts +1 -0
  71. package/types/types/toolbar.d.ts +12 -2
  72. package/types/types/ui.d.ts +1 -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.11.3
4
+ * Version: v4.11.5
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.11.3
4
+ * Version: v4.11.5
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.11.3
4
+ * Version: v4.11.5
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.11.3
4
+ * Version: v4.11.5
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.11.3
4
+ * Version: v4.11.5
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.11.3
4
+ * Version: v4.11.5
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.11.3
4
+ * Version: v4.11.5
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/es5/polyfills.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.11.3
4
+ * Version: v4.11.5
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.11.3
4
+ * Version: v4.11.5
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export const APP_VERSION = "4.11.3";
6
+ export const APP_VERSION = "4.11.5";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -36,7 +36,8 @@ export const UIButtonState = () => ({
36
36
  icon: {
37
37
  name: 'empty',
38
38
  fill: '',
39
- iconURL: ''
39
+ iconURL: '',
40
+ scale: undefined
40
41
  },
41
42
  tooltip: '',
42
43
  text: '',
@@ -50,13 +50,13 @@ export class Icon {
50
50
  return;
51
51
  }
52
52
  let iconElement;
53
- const { name, iconURL, fill } = icon;
53
+ const { name, iconURL, fill, scale } = icon;
54
54
  const clearName = name.replace(/[^a-zA-Z0-9]/g, '_');
55
55
  let iconFromEvent;
56
56
  if (!/<svg/.test(name)) {
57
57
  iconFromEvent = (_b = (_a = jodit.o).getIcon) === null || _b === void 0 ? void 0 : _b.call(_a, name, clearName);
58
58
  }
59
- const cacheKey = `${name}${iconURL}${fill}${iconFromEvent !== null && iconFromEvent !== void 0 ? iconFromEvent : ''}`;
59
+ const cacheKey = `${name}${iconURL}${fill}${scale !== null && scale !== void 0 ? scale : ''}${iconFromEvent !== null && iconFromEvent !== void 0 ? iconFromEvent : ''}`;
60
60
  if (jodit.o.cache && this.__cache.has(cacheKey)) {
61
61
  return (_c = this.__cache.get(cacheKey)) === null || _c === void 0 ? void 0 : _c.cloneNode(true);
62
62
  }
@@ -80,6 +80,9 @@ export class Icon {
80
80
  if (iconElement) {
81
81
  iconElement.classList.add('jodit-icon');
82
82
  iconElement.style.fill = fill;
83
+ if (scale != null) {
84
+ iconElement.style.transform = `scale(${scale})`;
85
+ }
83
86
  jodit.o.cache &&
84
87
  this.__cache.set(cacheKey, iconElement.cloneNode(true));
85
88
  }
@@ -21,5 +21,14 @@ export declare class ProgressBar extends UIElement implements IProgressBar {
21
21
  show(): IProgressBar;
22
22
  hide(): IProgressBar;
23
23
  progress(percentage: number): IProgressBar;
24
+ private __animationElement;
25
+ showFileUploadAnimation(from?: {
26
+ x: number;
27
+ y: number;
28
+ }, to?: {
29
+ x: number;
30
+ y: number;
31
+ }): void;
32
+ private __cleanUpAnimation;
24
33
  destruct(): any;
25
34
  }
@@ -4,8 +4,16 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import { Dom } from "../../dom/dom.js";
7
+ import { getContainer } from "../../global.js";
8
+ import { position } from "../../helpers/size/position.js";
9
+ import { css } from "../../helpers/utils/css.js";
7
10
  import { UIElement } from "../element.js";
11
+ import { Icon } from "../icon.js";
8
12
  export class ProgressBar extends UIElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.__animationElement = null;
16
+ }
9
17
  /** @override */
10
18
  className() {
11
19
  return 'ProgressBar';
@@ -30,7 +38,52 @@ export class ProgressBar extends UIElement {
30
38
  this.container.style.width = percentage.toFixed(2) + '%';
31
39
  return this;
32
40
  }
41
+ showFileUploadAnimation(from, to) {
42
+ this.__cleanUpAnimation();
43
+ const box = getContainer(this.j, ProgressBar);
44
+ const pos = position(this.j.container, this.j);
45
+ const el = this.j.c.div(this.getFullElName('file-animation'));
46
+ const iconSvg = Icon.get('file', '');
47
+ if (iconSvg) {
48
+ el.innerHTML = iconSvg;
49
+ }
50
+ const start = from !== null && from !== void 0 ? from : {
51
+ x: pos.width / 2,
52
+ y: 0
53
+ };
54
+ const end = to !== null && to !== void 0 ? to : {
55
+ x: start.x + 60,
56
+ y: start.y - 80
57
+ };
58
+ css(el, {
59
+ left: pos.left + start.x,
60
+ top: pos.top + start.y
61
+ });
62
+ box.appendChild(el);
63
+ this.__animationElement = el;
64
+ // Force reflow before starting transition
65
+ // eslint-disable-next-line no-unused-expressions
66
+ el.offsetWidth;
67
+ css(el, {
68
+ left: pos.left + end.x,
69
+ top: pos.top + end.y,
70
+ opacity: 0,
71
+ transform: 'scale(0.4)'
72
+ });
73
+ const onEnd = () => {
74
+ el.removeEventListener('transitionend', onEnd);
75
+ this.__cleanUpAnimation();
76
+ };
77
+ el.addEventListener('transitionend', onEnd);
78
+ }
79
+ __cleanUpAnimation() {
80
+ if (this.__animationElement) {
81
+ Dom.safeRemove(this.__animationElement);
82
+ this.__animationElement = null;
83
+ }
84
+ }
33
85
  destruct() {
86
+ this.__cleanUpAnimation();
34
87
  this.hide();
35
88
  return super.destruct();
36
89
  }
@@ -61,6 +61,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
61
61
  * Init constant data from control
62
62
  */
63
63
  protected __initFromControl(): void;
64
+ private __initIconFromControl;
64
65
  /**
65
66
  * Click on trigger button
66
67
  */
@@ -194,38 +194,48 @@ let ToolbarButton = class ToolbarButton extends UIButton {
194
194
  * Init constant data from control
195
195
  */
196
196
  __initFromControl() {
197
- var _a;
198
197
  const { control: ctr, state } = this;
199
198
  this.updateSize();
200
199
  state.name = ctr.name;
200
+ this.__initIconFromControl();
201
+ if (ctr.tooltip) {
202
+ state.tooltip = isFunction(ctr.tooltip)
203
+ ? ctr.tooltip(this.j, ctr, this)
204
+ : ctr.tooltip;
205
+ }
206
+ state.hasTrigger = Boolean(ctr.list || (ctr.popup && ctr.exec));
207
+ }
208
+ __initIconFromControl() {
209
+ var _a;
210
+ const { control: ctr, state } = this;
201
211
  const { textIcons } = this.j.o;
202
212
  if (textIcons === true ||
203
213
  (isFunction(textIcons) && textIcons(ctr.name)) ||
204
214
  ctr.template) {
205
215
  state.icon = UIButtonState().icon;
206
216
  state.text = ctr.text || ctr.name;
217
+ return;
218
+ }
219
+ if (!isString(ctr.icon) && ctr.icon != null) {
220
+ state.icon = {
221
+ name: ctr.icon.name || ctr.name,
222
+ iconURL: ctr.icon.iconURL || '',
223
+ fill: ctr.icon.fill || '',
224
+ scale: ctr.icon.scale
225
+ };
226
+ return;
227
+ }
228
+ if (ctr.iconURL) {
229
+ state.icon.iconURL = ctr.iconURL;
207
230
  }
208
231
  else {
209
- if (ctr.iconURL) {
210
- state.icon.iconURL = ctr.iconURL;
211
- }
212
- else {
213
- const name = ctr.icon || ctr.name;
214
- state.icon.name =
215
- Icon.exists(name) || ((_a = this.j.o.extraIcons) === null || _a === void 0 ? void 0 : _a[name])
216
- ? name
217
- : '';
218
- }
219
- if (!ctr.iconURL && !state.icon.name) {
220
- state.text = ctr.text || ctr.name;
221
- }
232
+ const name = ctr.icon || ctr.name;
233
+ state.icon.name =
234
+ Icon.exists(name) || ((_a = this.j.o.extraIcons) === null || _a === void 0 ? void 0 : _a[name]) ? name : '';
222
235
  }
223
- if (ctr.tooltip) {
224
- state.tooltip = isFunction(ctr.tooltip)
225
- ? ctr.tooltip(this.j, ctr, this)
226
- : ctr.tooltip;
236
+ if (!ctr.iconURL && !state.icon.name) {
237
+ state.text = ctr.text || ctr.name;
227
238
  }
228
- state.hasTrigger = Boolean(ctr.list || (ctr.popup && ctr.exec));
229
239
  }
230
240
  /**
231
241
  * Click on trigger button
@@ -7,7 +7,7 @@
7
7
  * @module types
8
8
  */
9
9
  import type { IFileBrowser } from "./file-browser";
10
- import type { IUIButton, IUIElement, IUIList } from "./ui";
10
+ import type { IUIButton, IUIElement, IUIIconState, IUIList } from "./ui";
11
11
  import type { IViewBased } from "./view";
12
12
  import type { IJodit } from "./jodit";
13
13
  import type { Modes, IDictionary, HTMLTagNames, Nullable, IContainer, IComponent, IBound } from "./types";
@@ -136,7 +136,7 @@ interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser
136
136
  * })
137
137
  * ```
138
138
  */
139
- icon?: string;
139
+ icon?: string | IUIIconState;
140
140
  /**
141
141
  * Use this property if you want set background image for the button. This icon can be 16 * 16 px in SVG or
142
142
  * another image formats
@@ -270,4 +270,14 @@ export interface IProgressBar extends IUIElement {
270
270
  show(): IProgressBar;
271
271
  hide(): IProgressBar;
272
272
  progress(percentage: number): IProgressBar;
273
+ /**
274
+ * Show file upload animation - file icon flies from `from` to `to` and fades out
275
+ */
276
+ showFileUploadAnimation(from?: {
277
+ x: number;
278
+ y: number;
279
+ }, to?: {
280
+ x: number;
281
+ y: number;
282
+ }): void;
273
283
  }
package/esm/types/ui.d.ts CHANGED
@@ -30,6 +30,7 @@ export interface IUIIconState {
30
30
  name: string;
31
31
  iconURL: string;
32
32
  fill: string;
33
+ scale: number | undefined;
33
34
  }
34
35
  export type ButtonVariant = 'initial' | 'outline' | 'default' | 'primary' | 'secondary' | 'success' | 'danger';
35
36
  export interface IUIButtonState {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.11.3",
3
+ "version": "4.11.5",
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",
@@ -21,5 +21,14 @@ export declare class ProgressBar extends UIElement implements IProgressBar {
21
21
  show(): IProgressBar;
22
22
  hide(): IProgressBar;
23
23
  progress(percentage: number): IProgressBar;
24
+ private __animationElement;
25
+ showFileUploadAnimation(from?: {
26
+ x: number;
27
+ y: number;
28
+ }, to?: {
29
+ x: number;
30
+ y: number;
31
+ }): void;
32
+ private __cleanUpAnimation;
24
33
  destruct(): any;
25
34
  }
@@ -61,6 +61,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
61
61
  * Init constant data from control
62
62
  */
63
63
  protected __initFromControl(): void;
64
+ private __initIconFromControl;
64
65
  /**
65
66
  * Click on trigger button
66
67
  */
@@ -7,7 +7,7 @@
7
7
  * @module types
8
8
  */
9
9
  import type { IFileBrowser } from "./file-browser";
10
- import type { IUIButton, IUIElement, IUIList } from "./ui";
10
+ import type { IUIButton, IUIElement, IUIIconState, IUIList } from "./ui";
11
11
  import type { IViewBased } from "./view";
12
12
  import type { IJodit } from "./jodit";
13
13
  import type { Modes, IDictionary, HTMLTagNames, Nullable, IContainer, IComponent, IBound } from "./types";
@@ -136,7 +136,7 @@ interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser
136
136
  * })
137
137
  * ```
138
138
  */
139
- icon?: string;
139
+ icon?: string | IUIIconState;
140
140
  /**
141
141
  * Use this property if you want set background image for the button. This icon can be 16 * 16 px in SVG or
142
142
  * another image formats
@@ -270,4 +270,14 @@ export interface IProgressBar extends IUIElement {
270
270
  show(): IProgressBar;
271
271
  hide(): IProgressBar;
272
272
  progress(percentage: number): IProgressBar;
273
+ /**
274
+ * Show file upload animation - file icon flies from `from` to `to` and fades out
275
+ */
276
+ showFileUploadAnimation(from?: {
277
+ x: number;
278
+ y: number;
279
+ }, to?: {
280
+ x: number;
281
+ y: number;
282
+ }): void;
273
283
  }
@@ -30,6 +30,7 @@ export interface IUIIconState {
30
30
  name: string;
31
31
  iconURL: string;
32
32
  fill: string;
33
+ scale: number | undefined;
33
34
  }
34
35
  export type ButtonVariant = 'initial' | 'outline' | 'default' | 'primary' | 'secondary' | 'success' | 'danger';
35
36
  export interface IUIButtonState {