jodit 4.15.18 → 4.16.0
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 +11 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +9 -8
- package/es2015/jodit.js +94 -48
- package/es2015/jodit.min.js +9 -8
- package/es2015/plugins/debug/debug.css +1 -1
- 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.fat.min.js +9 -8
- package/es2018/jodit.min.js +9 -8
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +10 -9
- package/es2021/jodit.js +94 -48
- package/es2021/jodit.min.js +10 -9
- package/es2021/plugins/debug/debug.css +1 -1
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +10 -9
- package/es2021.en/jodit.js +94 -48
- package/es2021.en/jodit.min.js +10 -9
- package/es2021.en/plugins/debug/debug.css +1 -1
- 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 +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +106 -54
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- 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/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/ui/button/button/button.js +10 -4
- package/esm/core/ui/form/inputs/file/file.js +1 -0
- package/esm/core/ui/group/group.d.ts +4 -0
- package/esm/core/ui/group/group.js +5 -1
- package/esm/core/ui/group/list.js +2 -2
- package/esm/modules/dialog/dialog.js +7 -0
- package/esm/modules/toolbar/button/content.d.ts +7 -0
- package/esm/modules/toolbar/button/content.js +9 -1
- package/esm/plugins/source/editor/engines/ace.js +13 -6
- package/esm/plugins/source/source.js +20 -1
- package/package.json +1 -1
- package/types/core/ui/group/group.d.ts +4 -0
- package/types/modules/toolbar/button/content.d.ts +7 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.
|
|
6
|
+
export const APP_VERSION = "4.16.0";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -112,6 +112,7 @@ let UIButton = class UIButton extends UIElement {
|
|
|
112
112
|
this.name = this.state.name;
|
|
113
113
|
attr(this.container, 'data-ref', this.state.name);
|
|
114
114
|
attr(this.container, 'ref', this.state.name);
|
|
115
|
+
this.updateAriaLabel();
|
|
115
116
|
}
|
|
116
117
|
onChangeTooltip() {
|
|
117
118
|
const i8nTooltip = this.state.tooltip
|
|
@@ -125,11 +126,16 @@ let UIButton = class UIButton extends UIElement {
|
|
|
125
126
|
}
|
|
126
127
|
updateAriaLabel() {
|
|
127
128
|
const hasText = this.state.text.trim().length > 0;
|
|
128
|
-
|
|
129
|
+
// An icon-only button without a tooltip would have no accessible
|
|
130
|
+
// name at all — fall back to its raw name (not translated: control
|
|
131
|
+
// names are identifiers, not i18n keys).
|
|
132
|
+
const label = this.state.tooltip
|
|
129
133
|
? this.jodit.i18n(this.state.tooltip)
|
|
130
|
-
:
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
: !hasText && this.state.name
|
|
135
|
+
? this.state.name
|
|
136
|
+
: null;
|
|
137
|
+
attr(this.container, 'aria-label', label);
|
|
138
|
+
attr(this.button, 'aria-label', !hasText ? label : null);
|
|
133
139
|
}
|
|
134
140
|
onChangeTabIndex() {
|
|
135
141
|
attr(this.container, 'tabindex', this.state.tabIndex);
|
|
@@ -43,6 +43,7 @@ let UIFileInput = class UIFileInput extends UIInput {
|
|
|
43
43
|
return this.j.create.fromHTML(`<input
|
|
44
44
|
type="file"
|
|
45
45
|
accept="${options.onlyImages ? 'image/*' : '*'}"
|
|
46
|
+
aria-label="${this.j.i18n(options.tooltip || 'Upload')}"
|
|
46
47
|
tabindex="-1"
|
|
47
48
|
dir="auto"
|
|
48
49
|
multiple=""
|
|
@@ -13,6 +13,10 @@ import { UIElement } from "../element";
|
|
|
13
13
|
export declare class UIGroup<T extends IViewBased = IViewBased> extends UIElement<T> implements IUIGroup {
|
|
14
14
|
readonly options?: IDictionary | undefined;
|
|
15
15
|
className(): string;
|
|
16
|
+
/**
|
|
17
|
+
* A generic container: `group` allows any children. Toolbar button groups
|
|
18
|
+
* are lists of `listitem`s and get `role="list"` explicitly from `UIList`.
|
|
19
|
+
*/
|
|
16
20
|
getRole(): string;
|
|
17
21
|
/**
|
|
18
22
|
* Synchronize mods to all children
|
|
@@ -23,9 +23,13 @@ let UIGroup = UIGroup_1 = class UIGroup extends UIElement {
|
|
|
23
23
|
className() {
|
|
24
24
|
return 'UIGroup';
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* A generic container: `group` allows any children. Toolbar button groups
|
|
28
|
+
* are lists of `listitem`s and get `role="list"` explicitly from `UIList`.
|
|
29
|
+
*/
|
|
26
30
|
getRole() {
|
|
27
31
|
var _a;
|
|
28
|
-
return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.role) || '
|
|
32
|
+
return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.role) || 'group';
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
35
|
* All group children
|
|
@@ -43,8 +43,8 @@ let UIList = class UIList extends UIGroup {
|
|
|
43
43
|
/**
|
|
44
44
|
* Make new group and append it in list of elements
|
|
45
45
|
*/
|
|
46
|
-
makeGroup(role) {
|
|
47
|
-
return new UIGroup(this.jodit, [],
|
|
46
|
+
makeGroup(role = 'list') {
|
|
47
|
+
return new UIGroup(this.jodit, [], { role });
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* All buttons from list
|
|
@@ -21,6 +21,7 @@ import { Dom } from "../../core/dom/dom.js";
|
|
|
21
21
|
import { eventEmitter, pluginSystem } from "../../core/global.js";
|
|
22
22
|
import { asArray, splitArray, toArray } from "../../core/helpers/array/index.js";
|
|
23
23
|
import { hasContainer, isArray, isBoolean, isFunction, isNumber, isString, isVoid } from "../../core/helpers/checker/index.js";
|
|
24
|
+
import { stripTags } from "../../core/helpers/html/strip-tags.js";
|
|
24
25
|
import { attr, ConfigProto, css } from "../../core/helpers/utils/index.js";
|
|
25
26
|
import { assert } from "../../core/helpers/utils/assert.js";
|
|
26
27
|
import { Icon } from "../../core/ui/index.js";
|
|
@@ -292,6 +293,12 @@ let Dialog = Dialog_1 = class Dialog extends ViewWithToolbar {
|
|
|
292
293
|
*/
|
|
293
294
|
setHeader(content) {
|
|
294
295
|
this.setElements(this.dialogbox_header, content);
|
|
296
|
+
// `role="dialog"` needs an accessible name; a text title is the
|
|
297
|
+
// natural one (element titles are left to the caller).
|
|
298
|
+
if (isString(content)) {
|
|
299
|
+
const name = stripTags(content, this.od).trim();
|
|
300
|
+
attr(this.container, 'aria-label', name || null);
|
|
301
|
+
}
|
|
295
302
|
return this;
|
|
296
303
|
}
|
|
297
304
|
/**
|
|
@@ -13,6 +13,13 @@ export declare class ToolbarContent<T extends IViewBased = IViewBased> extends U
|
|
|
13
13
|
readonly target: Nullable<HTMLElement>;
|
|
14
14
|
/** @override */
|
|
15
15
|
className(): string;
|
|
16
|
+
/** A toolbar item like `ToolbarButton`: the parent group is a `list`. */
|
|
17
|
+
getRole(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Arbitrary content is not a toggle button — `aria-pressed` is not
|
|
20
|
+
* allowed on a `listitem`.
|
|
21
|
+
*/
|
|
22
|
+
protected onChangeActivated(): void;
|
|
16
23
|
/** @override */
|
|
17
24
|
update(): void;
|
|
18
25
|
/**
|
|
@@ -28,6 +28,15 @@ let ToolbarContent = class ToolbarContent extends UIButton {
|
|
|
28
28
|
className() {
|
|
29
29
|
return 'ToolbarContent';
|
|
30
30
|
}
|
|
31
|
+
/** A toolbar item like `ToolbarButton`: the parent group is a `list`. */
|
|
32
|
+
getRole() {
|
|
33
|
+
return 'listitem';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Arbitrary content is not a toggle button — `aria-pressed` is not
|
|
37
|
+
* allowed on a `listitem`.
|
|
38
|
+
*/
|
|
39
|
+
onChangeActivated() { }
|
|
31
40
|
/** @override */
|
|
32
41
|
update() {
|
|
33
42
|
var _a, _b, _c;
|
|
@@ -73,7 +82,6 @@ let ToolbarContent = class ToolbarContent extends UIButton {
|
|
|
73
82
|
this.control = control;
|
|
74
83
|
this.target = target;
|
|
75
84
|
this.container.classList.add(`${this.componentName}_${this.clearName(control.name)}`);
|
|
76
|
-
attr(this.container, 'role', 'content');
|
|
77
85
|
}
|
|
78
86
|
};
|
|
79
87
|
ToolbarContent = __decorate([
|
|
@@ -127,23 +127,30 @@ export class AceEditor extends SourceEditor {
|
|
|
127
127
|
onResize();
|
|
128
128
|
this.onReady();
|
|
129
129
|
};
|
|
130
|
+
let loading = false;
|
|
130
131
|
const initAceEditor = () => {
|
|
131
132
|
if (editor.isInDestruct ||
|
|
132
133
|
(editor.getRealMode() !== constants.MODE_SOURCE &&
|
|
133
134
|
editor.getMode() !== constants.MODE_SPLIT)) {
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
137
|
+
// ACE (~400 KiB from the CDN) is only needed once the source view
|
|
138
|
+
// is actually shown — a page that stays in WYSIWYG must not
|
|
139
|
+
// download it.
|
|
140
|
+
if (!this.aceExists()) {
|
|
141
|
+
if (!loading) {
|
|
142
|
+
loading = true;
|
|
143
|
+
loadNext(editor, editor.o.sourceEditorCDNUrlsJS)
|
|
144
|
+
.then(initAceEditor)
|
|
145
|
+
.catch(() => null);
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
136
149
|
this.fromWYSIWYG();
|
|
137
150
|
tryInitAceEditor();
|
|
138
151
|
};
|
|
139
152
|
editor.e.on('afterSetMode', initAceEditor);
|
|
140
153
|
initAceEditor();
|
|
141
|
-
// global add ace editor in browser
|
|
142
|
-
if (!this.aceExists()) {
|
|
143
|
-
loadNext(editor, editor.o.sourceEditorCDNUrlsJS)
|
|
144
|
-
.then(initAceEditor)
|
|
145
|
-
.catch(() => null);
|
|
146
|
-
}
|
|
147
154
|
}
|
|
148
155
|
destruct() {
|
|
149
156
|
var _a, _b;
|
|
@@ -261,7 +261,26 @@ export class source extends Plugin {
|
|
|
261
261
|
return false;
|
|
262
262
|
};
|
|
263
263
|
if (!addEventListener()) {
|
|
264
|
-
|
|
264
|
+
// js-beautify is only needed once the source view is shown —
|
|
265
|
+
// do not download it for a page that stays in WYSIWYG.
|
|
266
|
+
let loading = false;
|
|
267
|
+
const loadBeautify = () => {
|
|
268
|
+
if (loading ||
|
|
269
|
+
(editor.getMode() !== MODE_SOURCE &&
|
|
270
|
+
editor.getMode() !== MODE_SPLIT)) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
loading = true;
|
|
274
|
+
loadNext(editor, editor.o.beautifyHTMLCDNUrlsJS).then(() => {
|
|
275
|
+
// The source view was filled before the
|
|
276
|
+
// beautifier arrived — format it now.
|
|
277
|
+
if (addEventListener()) {
|
|
278
|
+
this.syncValueFromWYSIWYG(true);
|
|
279
|
+
}
|
|
280
|
+
}, () => null);
|
|
281
|
+
};
|
|
282
|
+
editor.e.on('afterSetMode.source', loadBeautify);
|
|
283
|
+
loadBeautify();
|
|
265
284
|
}
|
|
266
285
|
}
|
|
267
286
|
this.syncValueFromWYSIWYG(true);
|
package/package.json
CHANGED
|
@@ -13,6 +13,10 @@ import { UIElement } from "../element";
|
|
|
13
13
|
export declare class UIGroup<T extends IViewBased = IViewBased> extends UIElement<T> implements IUIGroup {
|
|
14
14
|
readonly options?: IDictionary | undefined;
|
|
15
15
|
className(): string;
|
|
16
|
+
/**
|
|
17
|
+
* A generic container: `group` allows any children. Toolbar button groups
|
|
18
|
+
* are lists of `listitem`s and get `role="list"` explicitly from `UIList`.
|
|
19
|
+
*/
|
|
16
20
|
getRole(): string;
|
|
17
21
|
/**
|
|
18
22
|
* Synchronize mods to all children
|
|
@@ -13,6 +13,13 @@ export declare class ToolbarContent<T extends IViewBased = IViewBased> extends U
|
|
|
13
13
|
readonly target: Nullable<HTMLElement>;
|
|
14
14
|
/** @override */
|
|
15
15
|
className(): string;
|
|
16
|
+
/** A toolbar item like `ToolbarButton`: the parent group is a `list`. */
|
|
17
|
+
getRole(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Arbitrary content is not a toggle button — `aria-pressed` is not
|
|
20
|
+
* allowed on a `listitem`.
|
|
21
|
+
*/
|
|
22
|
+
protected onChangeActivated(): void;
|
|
16
23
|
/** @override */
|
|
17
24
|
update(): void;
|
|
18
25
|
/**
|