jodit 4.2.18 → 4.2.21

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 (70) hide show
  1. package/CHANGELOG.md +18 -7
  2. package/es2015/jodit.css +47 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +76 -64
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +2 -2
  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 +47 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +2 -2
  16. package/es2018/jodit.js +76 -64
  17. package/es2018/jodit.min.css +1 -1
  18. package/es2018/jodit.min.js +2 -2
  19. package/es2018/plugins/debug/debug.js +1 -1
  20. package/es2018/plugins/debug/debug.min.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  22. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  23. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  24. package/es2021/jodit.css +47 -1
  25. package/es2021/jodit.fat.min.css +1 -1
  26. package/es2021/jodit.fat.min.js +2 -2
  27. package/es2021/jodit.js +76 -64
  28. package/es2021/jodit.min.css +1 -1
  29. package/es2021/jodit.min.js +2 -2
  30. package/es2021/plugins/debug/debug.js +1 -1
  31. package/es2021/plugins/debug/debug.min.js +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  33. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  34. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  35. package/es2021.en/jodit.css +47 -1
  36. package/es2021.en/jodit.fat.min.css +1 -1
  37. package/es2021.en/jodit.fat.min.js +2 -2
  38. package/es2021.en/jodit.js +76 -64
  39. package/es2021.en/jodit.min.css +1 -1
  40. package/es2021.en/jodit.min.js +2 -2
  41. package/es2021.en/plugins/debug/debug.js +1 -1
  42. package/es2021.en/plugins/debug/debug.min.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  45. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  46. package/es5/jodit.css +77 -2
  47. package/es5/jodit.fat.min.css +1 -1
  48. package/es5/jodit.fat.min.js +2 -2
  49. package/es5/jodit.js +79 -63
  50. package/es5/jodit.min.css +3 -3
  51. package/es5/jodit.min.js +2 -2
  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/constants.js +1 -1
  58. package/esm/core/ui/button/button/button.d.ts +1 -0
  59. package/esm/core/ui/button/button/button.js +7 -0
  60. package/esm/core/ui/button/tooltip/tooltip.d.ts +3 -4
  61. package/esm/core/ui/button/tooltip/tooltip.js +44 -44
  62. package/esm/modules/toolbar/button/button.d.ts +1 -0
  63. package/esm/modules/toolbar/collection/collection.js +1 -1
  64. package/esm/modules/widget/tabs/tabs.js +21 -16
  65. package/esm/types/ui.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/types/core/ui/button/button/button.d.ts +1 -0
  68. package/types/core/ui/button/tooltip/tooltip.d.ts +3 -4
  69. package/types/modules/toolbar/button/button.d.ts +1 -0
  70. 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.2.18
4
+ * Version: v4.2.21
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.18
4
+ * Version: v4.2.21
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.18
4
+ * Version: v4.2.21
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.18
4
+ * Version: v4.2.21
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.18
4
+ * Version: v4.2.21
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.18";
6
+ export const APP_VERSION = "4.2.21";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -36,6 +36,7 @@ export declare class UIButton extends UIElement implements IUIButton {
36
36
  protected button: HTMLElement;
37
37
  protected onChangeSize(): void;
38
38
  protected onChangeType(): void;
39
+ protected onChangeRole(): void;
39
40
  /**
40
41
  * Set size from a parent list
41
42
  */
@@ -25,6 +25,7 @@ import { Icon } from "../../icon.js";
25
25
  export const UIButtonState = () => ({
26
26
  size: 'middle',
27
27
  type: 'button',
28
+ role: 'button',
28
29
  name: '',
29
30
  value: '',
30
31
  variant: 'initial',
@@ -73,6 +74,9 @@ let UIButton = class UIButton extends UIElement {
73
74
  onChangeType() {
74
75
  attr(this.container, 'type', this.state.type);
75
76
  }
77
+ onChangeRole() {
78
+ attr(this.container, 'role', this.state.role);
79
+ }
76
80
  /**
77
81
  * Set size from a parent list
78
82
  */
@@ -202,6 +206,9 @@ __decorate([
202
206
  __decorate([
203
207
  watch('state.type', { immediately: false })
204
208
  ], UIButton.prototype, "onChangeType", null);
209
+ __decorate([
210
+ watch('state.role', { immediately: false })
211
+ ], UIButton.prototype, "onChangeRole", null);
205
212
  __decorate([
206
213
  watch('parentElement')
207
214
  ], UIButton.prototype, "updateSize", null);
@@ -17,16 +17,15 @@ export declare class UITooltip extends UIElement {
17
17
  protected render(): string;
18
18
  constructor(view: IViewBased);
19
19
  private __listenClose;
20
- private __addListenersOnClose;
21
- private __removeListenersOnClose;
20
+ private __addListenersOnEnter;
21
+ private __removeListenersOnLeave;
22
22
  private __currentTarget;
23
23
  private __onMouseLeave;
24
24
  private __onMouseEnter;
25
25
  private __delayShowTimeout;
26
26
  private __hideTimeout;
27
- private __delayOpen;
28
27
  private __open;
29
- private __setPosition;
28
+ private __show;
30
29
  private __hide;
31
30
  private __hideDelay;
32
31
  destruct(): void;
@@ -21,6 +21,19 @@ import { getContainer } from "../../../global.js";
21
21
  import { position } from "../../../helpers/size/position.js";
22
22
  import { attr, css } from "../../../helpers/utils/index.js";
23
23
  import { UIElement } from "../../element.js";
24
+ const WINDOW_EVENTS_ON_HIDE = [
25
+ 'scroll.tooltip',
26
+ 'joditCloseDialog',
27
+ 'mouseleave.tooltip'
28
+ ];
29
+ const JODIT_EVENTS_ON_HIDE = [
30
+ 'escape.tooltip',
31
+ 'change.tooltip',
32
+ 'changePlace.tooltip',
33
+ 'afterOpenPopup.tooltip',
34
+ 'hidePopup.tooltip',
35
+ 'closeAllPopups.tooltip'
36
+ ];
24
37
  let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
25
38
  className() {
26
39
  return 'UITooltip';
@@ -39,7 +52,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
39
52
  view.o.showTooltip &&
40
53
  !view.o.useNativeTooltip) {
41
54
  view.hookStatus(STATUSES.ready, () => {
42
- // TODO Move it inside __open method. Now it is here because testcase failed with capturing
55
+ // TODO Move it inside __show method. Now it is here because testcase failed with capturing
43
56
  getContainer(this.j, UITooltip_1).appendChild(this.container);
44
57
  view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
45
58
  capture: true
@@ -47,44 +60,28 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
47
60
  });
48
61
  }
49
62
  }
50
- __addListenersOnClose() {
63
+ __addListenersOnEnter() {
51
64
  if (this.__listenClose) {
52
65
  return;
53
66
  }
54
67
  this.__listenClose = true;
55
68
  const view = this.j;
56
69
  view.e
57
- .on(view.ow, 'scroll.tooltip', this.__hide)
58
- .on(view.ow, 'joditCloseDialog', this.__hide)
59
- .on(view.container, 'mouseleave.tooltip', this.__hide)
60
- .on([
61
- 'escape.tooltip',
62
- 'change.tooltip',
63
- 'changePlace.tooltip',
64
- 'afterOpenPopup.tooltip',
65
- 'hidePopup.tooltip',
66
- 'closeAllPopups.tooltip'
67
- ], this.__hide)
68
- .on(view.container, 'mouseleave', this.__onMouseLeave, {
70
+ .on(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
71
+ .on(JODIT_EVENTS_ON_HIDE, this.__hide)
72
+ .on(view.container, 'mouseleave.tooltip', this.__onMouseLeave, {
69
73
  capture: true
70
74
  });
71
75
  }
72
- __removeListenersOnClose() {
76
+ __removeListenersOnLeave() {
73
77
  if (!this.__listenClose) {
74
78
  return;
75
79
  }
76
80
  this.__listenClose = false;
77
81
  const view = this.j;
78
82
  view.e
79
- .off(view.ow, 'scroll.tooltip', this.__hide)
80
- .off([
81
- 'escape.tooltip',
82
- 'change.tooltip',
83
- 'changePlace.tooltip',
84
- 'afterOpenPopup.tooltip',
85
- 'hidePopup.tooltip',
86
- 'closeAllPopups.tooltip'
87
- ], this.__hide)
83
+ .off(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
84
+ .off(JODIT_EVENTS_ON_HIDE, this.__hide)
88
85
  .off(view.container, 'mouseleave.tooltip', this.__onMouseLeave);
89
86
  }
90
87
  __onMouseLeave(e) {
@@ -110,29 +107,30 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
110
107
  return;
111
108
  }
112
109
  this.__currentTarget = e.target;
113
- const pos = position(e.target);
114
- this.__addListenersOnClose();
115
- this.__delayOpen(() => ({
116
- x: pos.left + pos.width / 2,
117
- y: pos.top + pos.height
118
- }), tooltip);
110
+ const target = e.target;
111
+ this.__open(() => {
112
+ const pos = position(target);
113
+ return {
114
+ x: pos.left + pos.width / 2,
115
+ y: pos.top + pos.height
116
+ };
117
+ }, tooltip);
119
118
  }
120
- __delayOpen(getPoint, content) {
121
- const to = this.j.o.showTooltipDelay || this.j.defaultTimeout;
119
+ __open(getPoint, content) {
120
+ this.__addListenersOnEnter();
121
+ this.__isOpened = true;
122
122
  this.j.async.clearTimeout(this.__hideTimeout);
123
123
  this.j.async.clearTimeout(this.__delayShowTimeout);
124
- this.__delayShowTimeout = this.j.async.setTimeout(() => this.__open(getPoint, content), {
125
- timeout: to,
126
- label: 'tooltip'
127
- });
124
+ const to = this.j.o.showTooltipDelay || this.j.defaultTimeout;
125
+ if (!to) {
126
+ this.__show(getPoint, content);
127
+ return;
128
+ }
129
+ this.__delayShowTimeout = this.j.async.setTimeout(() => this.__show(getPoint, content), to);
128
130
  }
129
- __open(getPoint, content) {
131
+ __show(getPoint, content) {
130
132
  this.setMod('visible', true);
131
133
  this.getElm('content').innerHTML = content;
132
- this.__isOpened = true;
133
- this.__setPosition(getPoint);
134
- }
135
- __setPosition(getPoint) {
136
134
  const point = getPoint();
137
135
  css(this.container, {
138
136
  left: point.x,
@@ -142,24 +140,26 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
142
140
  __hide() {
143
141
  this.j.async.clearTimeout(this.__delayShowTimeout);
144
142
  this.j.async.clearTimeout(this.__hideTimeout);
145
- this.__removeListenersOnClose();
143
+ this.__removeListenersOnLeave();
146
144
  if (this.__isOpened) {
147
145
  this.__isOpened = false;
148
146
  this.setMod('visible', false);
147
+ this.getElm('content').innerHTML = '';
149
148
  css(this.container, {
150
149
  left: -5000
151
150
  });
152
151
  }
153
152
  }
154
153
  __hideDelay() {
154
+ this.j.async.clearTimeout(this.__delayShowTimeout);
155
+ this.j.async.clearTimeout(this.__hideTimeout);
155
156
  if (!this.__isOpened) {
156
157
  return;
157
158
  }
158
- this.j.async.clearTimeout(this.__delayShowTimeout);
159
159
  this.__hideTimeout = this.async.setTimeout(this.__hide, this.j.defaultTimeout);
160
160
  }
161
161
  destruct() {
162
- this.j.e.off(this.j.container, 'mouseenter', this.__onMouseEnter);
162
+ this.j.e.off(this.j.container, 'mouseenter.tooltip', this.__onMouseEnter);
163
163
  this.__hide();
164
164
  super.destruct();
165
165
  }
@@ -25,6 +25,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
25
25
  value: string | number | boolean;
26
26
  variant: import("../../../types").ButtonVariant;
27
27
  type: "button" | "submit";
28
+ role: "button" | "tab";
28
29
  disabled: boolean;
29
30
  activated: boolean;
30
31
  icon: import("../../../types").IUIIconState;
@@ -116,7 +116,7 @@ __decorate([
116
116
  autobind
117
117
  ], ToolbarCollection.prototype, "__immediateUpdate", null);
118
118
  __decorate([
119
- debounce()
119
+ debounce(ctx => ctx.j.defaultTimeout, true)
120
120
  ], ToolbarCollection.prototype, "update", null);
121
121
  __decorate([
122
122
  hook('ready')
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { Component } from "../../../core/component/index.js";
7
7
  import { Dom } from "../../../core/dom/dom.js";
8
- import { $$ } from "../../../core/helpers/index.js";
9
8
  import { isFunction } from "../../../core/helpers/checker/is-function.js";
9
+ import { attr } from "../../../core/helpers/utils/attr.js";
10
10
  import { Button, UIElement } from "../../../core/ui/index.js";
11
11
  /**
12
12
  * Build tabs system
@@ -37,8 +37,16 @@ import { Button, UIElement } from "../../../core/ui/index.js";
37
37
  * ```
38
38
  */
39
39
  export const TabsWidget = (jodit, tabs, state) => {
40
- const box = jodit.c.div('jodit-tabs'), tabBox = jodit.c.div('jodit-tabs__wrapper'), buttons = jodit.c.div('jodit-tabs__buttons'), nameToTab = {}, buttonList = [];
41
- let firstTab = '', tabCount = 0;
40
+ const box = jodit.c.div('jodit-tabs');
41
+ const tabBox = jodit.c.div('jodit-tabs__wrapper');
42
+ const buttons = jodit.c.div('jodit-tabs__buttons');
43
+ attr(buttons, {
44
+ role: 'tablist',
45
+ 'aria-orientation': 'horizontal'
46
+ });
47
+ const nameToTab = {};
48
+ const buttonList = [];
49
+ let firstTab = '';
42
50
  box.appendChild(buttons);
43
51
  box.appendChild(tabBox);
44
52
  const setActive = (tab) => {
@@ -46,20 +54,21 @@ export const TabsWidget = (jodit, tabs, state) => {
46
54
  return;
47
55
  }
48
56
  buttonList.forEach(b => {
49
- b.state.variant = 'initial';
50
57
  b.state.activated = false;
51
58
  });
52
- $$('.jodit-tab', tabBox).forEach(a => {
53
- a.classList.remove('jodit-tab_active');
54
- });
55
- nameToTab[tab].button.state.variant = 'outline';
59
+ Object.values(nameToTab).forEach(({ tab }) => tab.classList.remove('jodit-tab_active'));
56
60
  nameToTab[tab].button.state.activated = true;
57
61
  nameToTab[tab].tab.classList.add('jodit-tab_active');
58
62
  };
59
63
  tabs.forEach(({ icon, name, content }) => {
60
- const tab = jodit.c.div('jodit-tab'), button = Button(jodit, icon || name, name);
64
+ const tab = jodit.c.div('jodit-tab');
65
+ attr(tab, {
66
+ role: 'tabpanel'
67
+ });
68
+ const button = Button(jodit, icon || name, name);
69
+ button.state.role = 'tab';
61
70
  // Stop lose the focus
62
- jodit.e.on(button.container, 'mousedown', (e) => e.preventDefault());
71
+ jodit.e.on(button.container, 'pointerdown', (e) => e.preventDefault());
63
72
  if (!firstTab) {
64
73
  firstTab = name;
65
74
  }
@@ -89,13 +98,9 @@ export const TabsWidget = (jodit, tabs, state) => {
89
98
  button,
90
99
  tab
91
100
  };
92
- tabCount += 1;
93
101
  });
94
- if (!tabCount) {
95
- return box;
96
- }
97
- $$('a', buttons).forEach(a => {
98
- a.style.width = (100 / tabCount).toFixed(10) + '%';
102
+ Object.values(nameToTab).forEach(({ button }) => {
103
+ button.container.style.width = (100 / tabs.length).toFixed(10) + '%';
99
104
  });
100
105
  const tab = !state || !state.activeTab || !nameToTab[state.activeTab]
101
106
  ? firstTab
package/esm/types/ui.d.ts CHANGED
@@ -37,6 +37,7 @@ export interface IUIButtonState {
37
37
  value: string | number | boolean;
38
38
  variant: ButtonVariant;
39
39
  type: 'button' | 'submit';
40
+ role: 'button' | 'tab';
40
41
  disabled: boolean;
41
42
  activated: boolean;
42
43
  icon: IUIIconState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.2.18",
3
+ "version": "4.2.21",
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",
@@ -36,6 +36,7 @@ export declare class UIButton extends UIElement implements IUIButton {
36
36
  protected button: HTMLElement;
37
37
  protected onChangeSize(): void;
38
38
  protected onChangeType(): void;
39
+ protected onChangeRole(): void;
39
40
  /**
40
41
  * Set size from a parent list
41
42
  */
@@ -17,16 +17,15 @@ export declare class UITooltip extends UIElement {
17
17
  protected render(): string;
18
18
  constructor(view: IViewBased);
19
19
  private __listenClose;
20
- private __addListenersOnClose;
21
- private __removeListenersOnClose;
20
+ private __addListenersOnEnter;
21
+ private __removeListenersOnLeave;
22
22
  private __currentTarget;
23
23
  private __onMouseLeave;
24
24
  private __onMouseEnter;
25
25
  private __delayShowTimeout;
26
26
  private __hideTimeout;
27
- private __delayOpen;
28
27
  private __open;
29
- private __setPosition;
28
+ private __show;
30
29
  private __hide;
31
30
  private __hideDelay;
32
31
  destruct(): void;
@@ -25,6 +25,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
25
25
  value: string | number | boolean;
26
26
  variant: import("../../../types").ButtonVariant;
27
27
  type: "button" | "submit";
28
+ role: "button" | "tab";
28
29
  disabled: boolean;
29
30
  activated: boolean;
30
31
  icon: import("../../../types").IUIIconState;
@@ -37,6 +37,7 @@ export interface IUIButtonState {
37
37
  value: string | number | boolean;
38
38
  variant: ButtonVariant;
39
39
  type: 'button' | 'submit';
40
+ role: 'button' | 'tab';
40
41
  disabled: boolean;
41
42
  activated: boolean;
42
43
  icon: IUIIconState;