jodit 4.13.8 → 4.13.9
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 +6 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +3 -3
- package/es2015/jodit.js +69 -5
- package/es2015/jodit.min.js +3 -3
- 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 +3 -3
- package/es2018/jodit.min.js +3 -3
- 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 +4 -3
- package/es2021/jodit.js +68 -5
- package/es2021/jodit.min.js +4 -3
- 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 +4 -3
- package/es2021.en/jodit.js +68 -5
- package/es2021.en/jodit.min.js +4 -3
- 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 +118 -14
- 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/config.d.ts +10 -0
- package/esm/core/constants.js +1 -1
- package/esm/plugins/mobile/config.d.ts +10 -0
- package/esm/plugins/mobile/mobile.js +72 -4
- package/package.json +1 -1
- package/types/config.d.ts +10 -0
- package/types/plugins/mobile/config.d.ts +10 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/config.d.ts
CHANGED
|
@@ -1493,14 +1493,24 @@ interface Config {
|
|
|
1493
1493
|
toolbarAdaptive: boolean;
|
|
1494
1494
|
/**
|
|
1495
1495
|
* The list of buttons that appear in the editor's toolbar for medium-sized spaces (≥ options.sizeMD).
|
|
1496
|
+
*
|
|
1497
|
+
* The set is constrained to `buttons`: resizing may only drop buttons on
|
|
1498
|
+
* smaller widths, never surface a button that is not in `buttons`. So if
|
|
1499
|
+
* you customise only `buttons` and leave this at its default, a narrow
|
|
1500
|
+
* editor still shows just your `buttons`. Set this explicitly (as a subset
|
|
1501
|
+
* of `buttons`) to get a different medium-width set.
|
|
1496
1502
|
*/
|
|
1497
1503
|
buttonsMD: ButtonsOption;
|
|
1498
1504
|
/**
|
|
1499
1505
|
* The list of buttons that appear in the editor's toolbar for small-sized spaces (≥ options.sizeSM).
|
|
1506
|
+
*
|
|
1507
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
1500
1508
|
*/
|
|
1501
1509
|
buttonsSM: ButtonsOption;
|
|
1502
1510
|
/**
|
|
1503
1511
|
* The list of buttons that appear in the editor's toolbar for extra-small spaces (less than options.sizeSM).
|
|
1512
|
+
*
|
|
1513
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
1504
1514
|
*/
|
|
1505
1515
|
buttonsXS: ButtonsOption;
|
|
1506
1516
|
}
|
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.13.
|
|
6
|
+
export const APP_VERSION = "4.13.9";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -19,14 +19,24 @@ declare module 'jodit/config' {
|
|
|
19
19
|
toolbarAdaptive: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* The list of buttons that appear in the editor's toolbar for medium-sized spaces (≥ options.sizeMD).
|
|
22
|
+
*
|
|
23
|
+
* The set is constrained to `buttons`: resizing may only drop buttons on
|
|
24
|
+
* smaller widths, never surface a button that is not in `buttons`. So if
|
|
25
|
+
* you customise only `buttons` and leave this at its default, a narrow
|
|
26
|
+
* editor still shows just your `buttons`. Set this explicitly (as a subset
|
|
27
|
+
* of `buttons`) to get a different medium-width set.
|
|
22
28
|
*/
|
|
23
29
|
buttonsMD: ButtonsOption;
|
|
24
30
|
/**
|
|
25
31
|
* The list of buttons that appear in the editor's toolbar for small-sized spaces (≥ options.sizeSM).
|
|
32
|
+
*
|
|
33
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
26
34
|
*/
|
|
27
35
|
buttonsSM: ButtonsOption;
|
|
28
36
|
/**
|
|
29
37
|
* The list of buttons that appear in the editor's toolbar for extra-small spaces (less than options.sizeSM).
|
|
38
|
+
*
|
|
39
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
30
40
|
*/
|
|
31
41
|
buttonsXS: ButtonsOption;
|
|
32
42
|
}
|
|
@@ -5,8 +5,76 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { pluginSystem } from "../../core/global.js";
|
|
7
7
|
import { splitArray, toArray } from "../../core/helpers/index.js";
|
|
8
|
-
import { flatButtonsSet } from "../../core/ui/helpers/buttons.js";
|
|
8
|
+
import { flatButtonsSet, isButtonGroup } from "../../core/ui/helpers/buttons.js";
|
|
9
9
|
import "./config.js";
|
|
10
|
+
const isButtonSeparator = (item) => item === '|' || item === '---' || item === '\n';
|
|
11
|
+
/**
|
|
12
|
+
* Constrain a responsive breakpoint set (`buttonsMD/SM/XS`) to the buttons the
|
|
13
|
+
* user actually asked for via `buttons`. Those breakpoint defaults are
|
|
14
|
+
* group-based supersets, so a custom (smaller) `buttons` list would otherwise
|
|
15
|
+
* see *extra* buttons appear on resize when the toolbar switched to a breakpoint
|
|
16
|
+
* set — resizing must only ever drop buttons, never add ones outside `buttons`.
|
|
17
|
+
*
|
|
18
|
+
* When the breakpoint set introduces nothing outside `buttons` (the default
|
|
19
|
+
* case, where `buttons` is the full superset), the list is returned untouched so
|
|
20
|
+
* the standard grouped mobile layout — groups, separators and `dots` — is
|
|
21
|
+
* preserved. See #1389.
|
|
22
|
+
*/
|
|
23
|
+
function fitToButtons(list, editor) {
|
|
24
|
+
var _a;
|
|
25
|
+
const allowed = flatButtonsSet(splitArray(editor.o.buttons), editor);
|
|
26
|
+
const groups = editor.getRegisteredButtonGroups();
|
|
27
|
+
let changed = false;
|
|
28
|
+
let hadDots = false;
|
|
29
|
+
const flat = [];
|
|
30
|
+
for (const item of list) {
|
|
31
|
+
if (isButtonGroup(item)) {
|
|
32
|
+
const members = [...item.buttons, ...((_a = groups[item.group]) !== null && _a !== void 0 ? _a : [])];
|
|
33
|
+
const kept = members.filter(button => allowed.has(button));
|
|
34
|
+
if (kept.length !== members.length) {
|
|
35
|
+
changed = true;
|
|
36
|
+
}
|
|
37
|
+
flat.push(...kept);
|
|
38
|
+
}
|
|
39
|
+
else if (isButtonSeparator(item)) {
|
|
40
|
+
flat.push(item);
|
|
41
|
+
}
|
|
42
|
+
else if (item === 'dots') {
|
|
43
|
+
hadDots = true;
|
|
44
|
+
}
|
|
45
|
+
else if (allowed.has(item)) {
|
|
46
|
+
flat.push(item);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
changed = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!changed) {
|
|
53
|
+
return list;
|
|
54
|
+
}
|
|
55
|
+
// Drop separators left dangling once the buttons around them were removed.
|
|
56
|
+
const cleaned = [];
|
|
57
|
+
for (const item of flat) {
|
|
58
|
+
if (isButtonSeparator(item) &&
|
|
59
|
+
(cleaned.length === 0 ||
|
|
60
|
+
isButtonSeparator(cleaned[cleaned.length - 1]))) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
cleaned.push(item);
|
|
64
|
+
}
|
|
65
|
+
while (cleaned.length && isButtonSeparator(cleaned[cleaned.length - 1])) {
|
|
66
|
+
cleaned.pop();
|
|
67
|
+
}
|
|
68
|
+
// Keep the "show all" overflow button only if some requested button is still
|
|
69
|
+
// hidden at this breakpoint.
|
|
70
|
+
if (hadDots) {
|
|
71
|
+
const shown = flatButtonsSet(cleaned, editor);
|
|
72
|
+
if (toArray(allowed).some(button => !shown.has(button))) {
|
|
73
|
+
cleaned.push('dots');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return cleaned;
|
|
77
|
+
}
|
|
10
78
|
/**
|
|
11
79
|
* Rebuild toolbar in depends on editor's width
|
|
12
80
|
*/
|
|
@@ -50,12 +118,12 @@ export function mobile(editor) {
|
|
|
50
118
|
return splitArray(editor.o.buttons);
|
|
51
119
|
}
|
|
52
120
|
if (width >= editor.o.sizeMD) {
|
|
53
|
-
return splitArray(editor.o.buttonsMD);
|
|
121
|
+
return fitToButtons(splitArray(editor.o.buttonsMD), editor);
|
|
54
122
|
}
|
|
55
123
|
if (width >= editor.o.sizeSM) {
|
|
56
|
-
return splitArray(editor.o.buttonsSM);
|
|
124
|
+
return fitToButtons(splitArray(editor.o.buttonsSM), editor);
|
|
57
125
|
}
|
|
58
|
-
return splitArray(editor.o.buttonsXS);
|
|
126
|
+
return fitToButtons(splitArray(editor.o.buttonsXS), editor);
|
|
59
127
|
})();
|
|
60
128
|
if (newStore.toString() !== store.toString()) {
|
|
61
129
|
store = newStore;
|
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -1493,14 +1493,24 @@ interface Config {
|
|
|
1493
1493
|
toolbarAdaptive: boolean;
|
|
1494
1494
|
/**
|
|
1495
1495
|
* The list of buttons that appear in the editor's toolbar for medium-sized spaces (≥ options.sizeMD).
|
|
1496
|
+
*
|
|
1497
|
+
* The set is constrained to `buttons`: resizing may only drop buttons on
|
|
1498
|
+
* smaller widths, never surface a button that is not in `buttons`. So if
|
|
1499
|
+
* you customise only `buttons` and leave this at its default, a narrow
|
|
1500
|
+
* editor still shows just your `buttons`. Set this explicitly (as a subset
|
|
1501
|
+
* of `buttons`) to get a different medium-width set.
|
|
1496
1502
|
*/
|
|
1497
1503
|
buttonsMD: ButtonsOption;
|
|
1498
1504
|
/**
|
|
1499
1505
|
* The list of buttons that appear in the editor's toolbar for small-sized spaces (≥ options.sizeSM).
|
|
1506
|
+
*
|
|
1507
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
1500
1508
|
*/
|
|
1501
1509
|
buttonsSM: ButtonsOption;
|
|
1502
1510
|
/**
|
|
1503
1511
|
* The list of buttons that appear in the editor's toolbar for extra-small spaces (less than options.sizeSM).
|
|
1512
|
+
*
|
|
1513
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
1504
1514
|
*/
|
|
1505
1515
|
buttonsXS: ButtonsOption;
|
|
1506
1516
|
}
|
|
@@ -19,14 +19,24 @@ declare module 'jodit/config' {
|
|
|
19
19
|
toolbarAdaptive: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* The list of buttons that appear in the editor's toolbar for medium-sized spaces (≥ options.sizeMD).
|
|
22
|
+
*
|
|
23
|
+
* The set is constrained to `buttons`: resizing may only drop buttons on
|
|
24
|
+
* smaller widths, never surface a button that is not in `buttons`. So if
|
|
25
|
+
* you customise only `buttons` and leave this at its default, a narrow
|
|
26
|
+
* editor still shows just your `buttons`. Set this explicitly (as a subset
|
|
27
|
+
* of `buttons`) to get a different medium-width set.
|
|
22
28
|
*/
|
|
23
29
|
buttonsMD: ButtonsOption;
|
|
24
30
|
/**
|
|
25
31
|
* The list of buttons that appear in the editor's toolbar for small-sized spaces (≥ options.sizeSM).
|
|
32
|
+
*
|
|
33
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
26
34
|
*/
|
|
27
35
|
buttonsSM: ButtonsOption;
|
|
28
36
|
/**
|
|
29
37
|
* The list of buttons that appear in the editor's toolbar for extra-small spaces (less than options.sizeSM).
|
|
38
|
+
*
|
|
39
|
+
* Constrained to `buttons` — see {@link buttonsMD}.
|
|
30
40
|
*/
|
|
31
41
|
buttonsXS: ButtonsOption;
|
|
32
42
|
}
|