jodit 4.2.19 → 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.
- package/CHANGELOG.md +12 -5
- package/es2015/jodit.css +47 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +75 -63
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +2 -2
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.css +47 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +75 -63
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.js +1 -1
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +47 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +75 -63
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +2 -2
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +47 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +75 -63
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +2 -2
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +77 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +78 -62
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/ui/button/button/button.d.ts +1 -0
- package/esm/core/ui/button/button/button.js +7 -0
- package/esm/core/ui/button/tooltip/tooltip.d.ts +3 -4
- package/esm/core/ui/button/tooltip/tooltip.js +44 -44
- package/esm/modules/toolbar/button/button.d.ts +1 -0
- package/esm/modules/widget/tabs/tabs.js +21 -16
- package/esm/types/ui.d.ts +1 -0
- package/package.json +1 -1
- package/types/core/ui/button/button/button.d.ts +1 -0
- package/types/core/ui/button/tooltip/tooltip.d.ts +3 -4
- package/types/modules/toolbar/button/button.d.ts +1 -0
- package/types/types/ui.d.ts +1 -0
package/esm/core/constants.js
CHANGED
|
@@ -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.
|
|
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;
|
|
@@ -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
|
|
21
|
-
private
|
|
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
|
|
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
|
|
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
|
-
|
|
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,
|
|
58
|
-
.on(
|
|
59
|
-
.on(view.container, 'mouseleave.tooltip', this.
|
|
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
|
-
|
|
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,
|
|
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
|
|
114
|
-
this.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
121
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
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.
|
|
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;
|
|
@@ -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')
|
|
41
|
-
|
|
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
|
-
|
|
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')
|
|
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, '
|
|
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
|
-
|
|
95
|
-
|
|
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
package/package.json
CHANGED
|
@@ -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
|
|
21
|
-
private
|
|
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
|
|
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;
|