jodit 3.23.3 → 3.24.2
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/README.md +4 -4
- package/build/jodit.css +8 -3
- package/build/jodit.es2018.css +7 -2
- package/build/jodit.es2018.en.css +7 -2
- package/build/jodit.es2018.en.js +8384 -7869
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +8384 -7869
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +2954 -2414
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/build/plugins/debug/debug.es2018.en.js +8 -8
- package/build/plugins/debug/debug.es2018.en.min.js +1 -1
- package/build/plugins/debug/debug.es2018.js +8 -8
- package/build/plugins/debug/debug.es2018.min.js +1 -1
- package/build/plugins/debug/debug.js +8 -8
- package/build/plugins/debug/debug.min.js +1 -1
- package/build/plugins/speech-recognize/speech-recognize.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.js +38 -38
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.min.js +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.js +38 -38
- package/build/plugins/speech-recognize/speech-recognize.es2018.min.js +1 -1
- package/build/plugins/speech-recognize/speech-recognize.js +30 -30
- package/build/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/build/vdom.css +12 -1
- package/build/vdom.js +1445 -41
- package/package.json +23 -23
- package/src/core/constants.ts +10 -8
- package/src/core/dom/dom.test.js +25 -0
- package/src/core/dom/dom.ts +90 -41
- package/src/core/helpers/checker/has-browser-color-picker.ts +2 -2
- package/src/core/helpers/checker/index.ts +1 -0
- package/src/core/helpers/checker/is-boolean.ts +1 -1
- package/src/core/helpers/checker/is-marker.ts +20 -0
- package/src/core/helpers/normalize/normalize-css-value.ts +19 -0
- package/src/core/helpers/normalize/normalize-node.ts +2 -2
- package/src/core/helpers/size/position.test.js +198 -187
- package/src/core/helpers/utils/css.ts +7 -14
- package/src/core/plugin/plugin.ts +1 -1
- package/src/core/selection/interface.ts +24 -0
- package/src/core/selection/select.ts +69 -29
- package/src/core/selection/selection.test.js +5 -17
- package/src/core/selection/style/api/extract.ts +6 -7
- package/src/core/selection/style/api/finite-state-machine.ts +40 -35
- package/src/core/selection/style/api/get-suit-child.ts +3 -4
- package/src/core/selection/style/api/get-suit-parent.ts +3 -4
- package/src/core/selection/style/api/{element-has-same-style.ts → has-same-style.ts} +25 -6
- package/src/core/selection/style/api/index.ts +6 -6
- package/src/core/selection/style/api/is-inside-invisible-element.ts +1 -1
- package/src/core/selection/style/api/is-normal-node.ts +3 -3
- package/src/core/selection/style/api/is-same-attributes.ts +56 -0
- package/src/core/selection/style/api/is-suit-element.ts +22 -12
- package/src/core/selection/style/api/list/toggle-ordered-list.ts +100 -0
- package/src/core/selection/style/api/list/wrap-list.ts +71 -0
- package/src/core/selection/style/api/toggle-attributes.ts +251 -0
- package/src/core/selection/style/api/unwrap-children.ts +10 -8
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +7 -8
- package/src/core/selection/style/api/{wrap-and-commit-style.ts → wrap.ts} +8 -11
- package/src/core/selection/style/apply-style.ts +32 -181
- package/src/core/selection/style/commit-style.ts +79 -4
- package/src/core/selection/style/style.test.js +457 -128
- package/src/core/selection/style/transactions.ts +256 -0
- package/src/core/ui/button/tooltip/tooltip.test.js +95 -76
- package/src/core/ui/popup/popup.test.js +158 -153
- package/src/{plugins/backspace/interface.d.ts → core/vdom/on-demand.ts} +7 -5
- package/src/core/vdom/render/index.ts +2 -4
- package/src/core/vdom/render/patcher.ts +14 -0
- package/src/core/vdom/v-dom-jodit.less +17 -0
- package/src/core/vdom/v-dom-jodit.ts +102 -3
- package/src/core/view/view.ts +2 -2
- package/src/index.ts +2 -0
- package/src/jodit.ts +5 -1
- package/src/langs/i18n.test.js +221 -216
- package/src/modules/dialog/dialog.less +9 -1
- package/src/modules/dialog/dialog.ts +25 -16
- package/src/modules/file-browser/data-provider.ts +44 -12
- package/src/modules/file-browser/file-browser.test.js +1019 -958
- package/src/modules/file-browser/file-browser.ts +0 -1
- package/src/modules/messages/messages.ts +3 -8
- package/src/plugins/backspace/backspace.test.js +2 -9
- package/src/plugins/backspace/backspace.ts +5 -0
- package/src/plugins/backspace/cases/check-join-neighbors.ts +7 -1
- package/src/plugins/backspace/cases/check-join-two-lists.ts +2 -1
- package/src/plugins/backspace/helpers.ts +9 -1
- package/src/plugins/backspace/interface.ts +31 -0
- package/src/plugins/clean-html/helpers/visitor/filters/fill-empty-paragraph.ts +2 -1
- package/src/plugins/color/color.test.js +122 -119
- package/src/plugins/enter/enter.test.js +18 -5
- package/src/plugins/enter/enter.ts +9 -5
- package/src/plugins/enter/interface.ts +41 -0
- package/src/plugins/font/config.ts +8 -8
- package/src/plugins/font/font.test.js +18 -23
- package/src/plugins/hotkeys/hotkeys.test.js +35 -47
- package/src/plugins/iframe/iframe.test.js +206 -195
- package/src/plugins/image/image.ts +1 -1
- package/src/plugins/image-properties/config.ts +22 -0
- package/src/plugins/image-properties/image-properties.test.js +174 -93
- package/src/plugins/image-properties/templates/position-tab.ts +22 -1
- package/src/plugins/indent/indent.test.js +2 -8
- package/src/plugins/link/link.test.js +19 -0
- package/src/plugins/link/link.ts +25 -15
- package/src/plugins/placeholder/placeholder.ts +8 -7
- package/src/plugins/size/size.test.js +239 -225
- package/src/plugins/tab/cases/on-tab-inside-li.ts +131 -22
- package/src/plugins/tab/tab.test.js +95 -11
- package/src/plugins/tab/tab.ts +22 -2
- package/src/plugins/wrap-nodes/config.ts +11 -0
- package/src/plugins/wrap-nodes/wrap-nodes.ts +0 -1
- package/src/types/events.d.ts +4 -0
- package/src/types/file-browser.d.ts +17 -10
- package/src/types/select.d.ts +6 -1
- package/src/types/style.d.ts +72 -5
- package/src/types/uploader.d.ts +14 -0
- package/src/types/view.d.ts +2 -2
- package/types/core/async/async.d.ts +1 -1
- package/types/core/constants.d.ts +3 -3
- package/types/core/dom/dom.d.ts +6 -3
- package/types/core/helpers/checker/index.d.ts +1 -0
- package/types/core/helpers/checker/is-boolean.d.ts +1 -1
- package/types/core/helpers/checker/is-marker.d.ts +10 -0
- package/types/core/helpers/html/safe-html.d.ts +1 -1
- package/types/core/helpers/normalize/normalize-css-value.d.ts +2 -0
- package/types/core/helpers/normalize/normalize-node.d.ts +1 -1
- package/types/core/helpers/utils/append-script.d.ts +1 -1
- package/types/core/selection/interface.d.ts +19 -0
- package/types/core/selection/select.d.ts +22 -5
- package/types/core/selection/style/api/finite-state-machine.d.ts +10 -9
- package/types/core/selection/style/api/get-suit-child.d.ts +2 -3
- package/types/core/selection/style/api/get-suit-parent.d.ts +2 -3
- package/types/core/selection/style/api/{element-has-same-style.d.ts → has-same-style.d.ts} +2 -2
- package/types/core/selection/style/api/index.d.ts +6 -6
- package/types/core/selection/style/api/is-same-attributes.d.ts +12 -0
- package/types/core/selection/style/api/is-suit-element.d.ts +4 -4
- package/types/core/selection/style/api/{toggle → list}/toggle-ordered-list.d.ts +2 -3
- package/types/core/selection/style/api/{wrap-ordered-list.d.ts → list/wrap-list.d.ts} +2 -3
- package/types/core/selection/style/api/toggle-attributes.d.ts +11 -0
- package/types/core/selection/style/api/unwrap-children.d.ts +2 -2
- package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -3
- package/types/core/selection/style/api/{wrap-and-commit-style.d.ts → wrap.d.ts} +2 -3
- package/types/core/selection/style/apply-style.d.ts +3 -3
- package/types/core/selection/style/commit-style.d.ts +6 -2
- package/types/core/selection/style/transactions.d.ts +29 -0
- package/types/core/ui/popup/popup.d.ts +1 -1
- package/types/core/view/view.d.ts +1 -1
- package/types/index.d.ts +2 -0
- package/types/modules/file-browser/builders/elements-map.d.ts +1 -1
- package/types/modules/file-browser/data-provider.d.ts +5 -0
- package/types/modules/messages/messages.d.ts +2 -1
- package/types/plugins/backspace/helpers.d.ts +5 -1
- package/types/plugins/backspace/interface.d.ts +21 -0
- package/types/plugins/enter/enter.d.ts +2 -0
- package/types/plugins/enter/interface.d.ts +32 -0
- package/types/plugins/image-properties/config.d.ts +19 -0
- package/types/plugins/link/link.d.ts +1 -1
- package/types/plugins/paste/interface.d.ts +2 -2
- package/types/plugins/tab/cases/on-tab-inside-li.d.ts +1 -1
- package/types/plugins/wrap-nodes/config.d.ts +10 -0
- package/types/types/events.d.ts +4 -0
- package/types/types/file-browser.d.ts +17 -10
- package/types/types/select.d.ts +6 -1
- package/types/types/storage.d.ts +1 -1
- package/types/types/style.d.ts +72 -5
- package/types/types/uploader.d.ts +14 -0
- package/types/types/view.d.ts +2 -2
- package/vdom.html +20 -0
- package/src/core/selection/style/api/toggle/toggle-css.ts +0 -136
- package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +0 -54
- package/src/core/selection/style/api/toggle-commit-styles.ts +0 -35
- package/src/core/selection/style/api/wrap-ordered-list.ts +0 -42
- package/types/core/selection/style/api/toggle/toggle-css.d.ts +0 -12
- package/types/core/selection/style/api/toggle-commit-styles.d.ts +0 -13
package/src/langs/i18n.test.js
CHANGED
|
@@ -3,82 +3,45 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
it('Should replace it on defined language', function () {
|
|
12
|
-
const values = [
|
|
13
|
-
'Type something',
|
|
14
|
-
'Напишите что-либо',
|
|
15
|
-
'ru',
|
|
16
|
-
|
|
17
|
-
'rename',
|
|
18
|
-
'Переименовать',
|
|
19
|
-
'ru',
|
|
20
|
-
|
|
21
|
-
'Rename',
|
|
22
|
-
'Переименовать',
|
|
23
|
-
'ru',
|
|
24
|
-
|
|
25
|
-
'About Jodit',
|
|
26
|
-
'حول جوديت',
|
|
27
|
-
'ar',
|
|
28
|
-
|
|
29
|
-
'about Jodit',
|
|
30
|
-
'حول جوديت',
|
|
31
|
-
'ar',
|
|
32
|
-
|
|
33
|
-
'British people',
|
|
34
|
-
'British people',
|
|
35
|
-
'ar'
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
for (let i = 0; i < values.length; i += 3) {
|
|
39
|
-
expect(values[i + 1]).equals(
|
|
40
|
-
i18n(
|
|
41
|
-
values[i],
|
|
42
|
-
[],
|
|
43
|
-
{
|
|
44
|
-
language: values[i + 2]
|
|
45
|
-
},
|
|
46
|
-
true
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
6
|
+
('i18n' in window.skipTest ? describe.skip : describe)(
|
|
7
|
+
'Test i18n functionality',
|
|
8
|
+
function () {
|
|
9
|
+
describe('Helper 18n', function () {
|
|
10
|
+
const i18n = Jodit.modules.Helpers.i18n;
|
|
51
11
|
|
|
52
|
-
describe('Put
|
|
53
|
-
it('Should
|
|
12
|
+
describe('Put defined sentence', function () {
|
|
13
|
+
it('Should replace it on defined language', function () {
|
|
54
14
|
const values = [
|
|
55
|
-
'
|
|
56
|
-
'
|
|
15
|
+
'Type something',
|
|
16
|
+
'Напишите что-либо',
|
|
57
17
|
'ru',
|
|
58
|
-
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'ru',
|
|
62
|
-
['Test'],
|
|
63
|
-
'select %s',
|
|
64
|
-
'Выделить: Test',
|
|
18
|
+
|
|
19
|
+
'rename',
|
|
20
|
+
'Переименовать',
|
|
65
21
|
'ru',
|
|
66
|
-
|
|
67
|
-
'
|
|
68
|
-
'
|
|
22
|
+
|
|
23
|
+
'Rename',
|
|
24
|
+
'Переименовать',
|
|
69
25
|
'ru',
|
|
70
|
-
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
|
|
26
|
+
|
|
27
|
+
'About Jodit',
|
|
28
|
+
'حول جوديت',
|
|
29
|
+
'ar',
|
|
30
|
+
|
|
31
|
+
'about Jodit',
|
|
32
|
+
'حول جوديت',
|
|
33
|
+
'ar',
|
|
34
|
+
|
|
35
|
+
'British people',
|
|
36
|
+
'British people',
|
|
37
|
+
'ar'
|
|
75
38
|
];
|
|
76
39
|
|
|
77
|
-
for (let i = 0; i < values.length; i +=
|
|
40
|
+
for (let i = 0; i < values.length; i += 3) {
|
|
78
41
|
expect(values[i + 1]).equals(
|
|
79
42
|
i18n(
|
|
80
43
|
values[i],
|
|
81
|
-
|
|
44
|
+
[],
|
|
82
45
|
{
|
|
83
46
|
language: values[i + 2]
|
|
84
47
|
},
|
|
@@ -87,167 +50,209 @@ describe('Test i18n functionality', function () {
|
|
|
87
50
|
);
|
|
88
51
|
}
|
|
89
52
|
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
53
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
54
|
+
describe('Put some information inside sentence', function () {
|
|
55
|
+
it('Should put this information inside new sentence', function () {
|
|
56
|
+
const values = [
|
|
57
|
+
'Chars: %d',
|
|
58
|
+
'Символов: 1',
|
|
59
|
+
'ru',
|
|
60
|
+
[1],
|
|
61
|
+
'Select %s',
|
|
62
|
+
'Выделить: Test',
|
|
63
|
+
'ru',
|
|
64
|
+
['Test'],
|
|
65
|
+
'select %s',
|
|
66
|
+
'Выделить: Test',
|
|
67
|
+
'ru',
|
|
68
|
+
['Test'],
|
|
69
|
+
'Bla %d Bla %s',
|
|
70
|
+
'Bla 1 Bla boo',
|
|
71
|
+
'ru',
|
|
72
|
+
[1, 'boo'],
|
|
73
|
+
'Bla %d Bla %s',
|
|
74
|
+
'Bla 1 Bla boo',
|
|
75
|
+
'ru1',
|
|
76
|
+
[1, 'boo']
|
|
77
|
+
];
|
|
117
78
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
);
|
|
79
|
+
for (let i = 0; i < values.length; i += 4) {
|
|
80
|
+
expect(values[i + 1]).equals(
|
|
81
|
+
i18n(
|
|
82
|
+
values[i],
|
|
83
|
+
values[i + 3],
|
|
84
|
+
{
|
|
85
|
+
language: values[i + 2]
|
|
86
|
+
},
|
|
87
|
+
true
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
131
92
|
});
|
|
132
93
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
94
|
+
|
|
95
|
+
const values = [
|
|
96
|
+
'Type something',
|
|
97
|
+
'Напишите что-либо',
|
|
98
|
+
'ru',
|
|
99
|
+
|
|
100
|
+
'About Jodit',
|
|
101
|
+
'حول جوديت',
|
|
102
|
+
'ar',
|
|
103
|
+
|
|
104
|
+
'About Jodit',
|
|
105
|
+
'{About Jodit}',
|
|
106
|
+
'ar1',
|
|
107
|
+
|
|
108
|
+
'British people',
|
|
109
|
+
'{British people}',
|
|
110
|
+
'ar'
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
for (let i = 0; i < values.length; i += 3) {
|
|
114
|
+
const [source, result, language] = [
|
|
115
|
+
values[i],
|
|
116
|
+
values[i + 1],
|
|
117
|
+
values[i + 2]
|
|
147
118
|
];
|
|
148
119
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
120
|
+
describe(`Debug mode for ${language}`, function () {
|
|
121
|
+
it(`Should show debug brackets for undefined keys for source ${source}`, function () {
|
|
122
|
+
expect(result).equals(
|
|
123
|
+
i18n(
|
|
124
|
+
source,
|
|
125
|
+
[],
|
|
126
|
+
{
|
|
127
|
+
language,
|
|
128
|
+
debugLanguage: true
|
|
129
|
+
},
|
|
130
|
+
true
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
describe('Define i18n property inside input options', function () {
|
|
138
|
+
it('Should use it', function () {
|
|
139
|
+
const values = [
|
|
140
|
+
'Type something',
|
|
141
|
+
'Привет',
|
|
142
|
+
'ru',
|
|
143
|
+
'About Jodit',
|
|
144
|
+
'جوديت',
|
|
145
|
+
'ar',
|
|
146
|
+
'British people',
|
|
147
|
+
'Bond',
|
|
148
|
+
'ar'
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
const opt = {
|
|
152
|
+
ru: {
|
|
153
|
+
'Type something': 'Привет'
|
|
154
|
+
},
|
|
155
|
+
ar: {
|
|
156
|
+
'About Jodit': 'جوديت',
|
|
157
|
+
'British people': 'Bond'
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
for (let i = 0; i < values.length; i += 3) {
|
|
162
|
+
expect(values[i + 1]).equals(
|
|
163
|
+
i18n(
|
|
164
|
+
values[i],
|
|
165
|
+
[],
|
|
166
|
+
{
|
|
167
|
+
language: values[i + 2],
|
|
168
|
+
i18n: opt,
|
|
169
|
+
debugLanguage: true
|
|
170
|
+
},
|
|
171
|
+
true
|
|
172
|
+
)
|
|
173
|
+
);
|
|
156
174
|
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
for (let i = 0; i < values.length; i += 3) {
|
|
160
|
-
expect(values[i + 1]).equals(
|
|
161
|
-
i18n(
|
|
162
|
-
values[i],
|
|
163
|
-
[],
|
|
164
|
-
{
|
|
165
|
-
language: values[i + 2],
|
|
166
|
-
i18n: opt,
|
|
167
|
-
debugLanguage: true
|
|
168
|
-
},
|
|
169
|
-
true
|
|
170
|
-
)
|
|
171
|
-
);
|
|
172
|
-
}
|
|
175
|
+
});
|
|
173
176
|
});
|
|
174
177
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
debugLanguage: true
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
i18nkeys
|
|
219
|
-
.filter(function (key) {
|
|
220
|
-
return (
|
|
221
|
-
filter.indexOf(key) === -1 &&
|
|
222
|
-
!/^[0-9]+(\.[0-9]+)?(pt|px)?$/.test(key)
|
|
223
|
-
);
|
|
224
|
-
})
|
|
225
|
-
.forEach(function (key) {
|
|
226
|
-
expect('{' + key + '}').does.not.equal(
|
|
227
|
-
editor.i18n(key)
|
|
228
|
-
);
|
|
178
|
+
|
|
179
|
+
describe('Test has keys in all functionality', function () {
|
|
180
|
+
const filter = [
|
|
181
|
+
'customxxx',
|
|
182
|
+
'customxxx',
|
|
183
|
+
'lineHeight',
|
|
184
|
+
'Ok',
|
|
185
|
+
'Link',
|
|
186
|
+
'Code',
|
|
187
|
+
'Embed code',
|
|
188
|
+
'Normal',
|
|
189
|
+
'Text',
|
|
190
|
+
'Split',
|
|
191
|
+
'Jodit Editor',
|
|
192
|
+
'License: %s',
|
|
193
|
+
'Split vertical',
|
|
194
|
+
'Src',
|
|
195
|
+
'Edit',
|
|
196
|
+
'Split horizontal',
|
|
197
|
+
'Styles',
|
|
198
|
+
'Classes',
|
|
199
|
+
'Alternative',
|
|
200
|
+
'Image',
|
|
201
|
+
'spellcheck',
|
|
202
|
+
'Border'
|
|
203
|
+
];
|
|
204
|
+
|
|
205
|
+
Object.keys(Jodit.lang)
|
|
206
|
+
.filter(function (language) {
|
|
207
|
+
return language !== 'en';
|
|
208
|
+
})
|
|
209
|
+
.forEach(function (language) {
|
|
210
|
+
it(
|
|
211
|
+
'Should have value for all key in ' +
|
|
212
|
+
language +
|
|
213
|
+
' language',
|
|
214
|
+
function () {
|
|
215
|
+
const editor = getJodit({
|
|
216
|
+
language: language,
|
|
217
|
+
debugLanguage: true
|
|
229
218
|
});
|
|
219
|
+
|
|
220
|
+
i18nkeys
|
|
221
|
+
.filter(function (key) {
|
|
222
|
+
return (
|
|
223
|
+
filter.indexOf(key) === -1 &&
|
|
224
|
+
!/^[0-9]+(\.[0-9]+)?(pt|px)?$/.test(key)
|
|
225
|
+
);
|
|
226
|
+
})
|
|
227
|
+
.forEach(function (key) {
|
|
228
|
+
expect('{' + key + '}').does.not.equal(
|
|
229
|
+
editor.i18n(key)
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
describe('Test i18n function', function () {
|
|
237
|
+
it('Should show value in current language', function () {
|
|
238
|
+
const editor = getJodit({
|
|
239
|
+
language: 'ru',
|
|
240
|
+
i18n: {
|
|
241
|
+
ru: {
|
|
242
|
+
'Test %s': 'Тест %s',
|
|
243
|
+
'Test %d': 'Тест %d',
|
|
244
|
+
'Test %s %d': 'Тест %s %d'
|
|
245
|
+
}
|
|
230
246
|
}
|
|
247
|
+
});
|
|
248
|
+
expect(editor.i18n('Type something')).equals(
|
|
249
|
+
'Напишите что-либо'
|
|
250
|
+
);
|
|
251
|
+
expect(editor.i18n('Test %s', 'строка')).equals('Тест строка');
|
|
252
|
+
expect(editor.i18n('Test %s %d', 'строка', 1)).equals(
|
|
253
|
+
'Тест строка 1'
|
|
231
254
|
);
|
|
232
255
|
});
|
|
233
|
-
});
|
|
234
|
-
describe('Test i18n function', function () {
|
|
235
|
-
it('Should show value in current language', function () {
|
|
236
|
-
const editor = getJodit({
|
|
237
|
-
language: 'ru',
|
|
238
|
-
i18n: {
|
|
239
|
-
ru: {
|
|
240
|
-
'Test %s': 'Тест %s',
|
|
241
|
-
'Test %d': 'Тест %d',
|
|
242
|
-
'Test %s %d': 'Тест %s %d'
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
expect(editor.i18n('Type something')).equals('Напишите что-либо');
|
|
247
|
-
expect(editor.i18n('Test %s', 'строка')).equals('Тест строка');
|
|
248
|
-
expect(editor.i18n('Test %s %d', 'строка', 1)).equals(
|
|
249
|
-
'Тест строка 1'
|
|
250
|
-
);
|
|
251
256
|
});
|
|
252
|
-
}
|
|
253
|
-
|
|
257
|
+
}
|
|
258
|
+
);
|
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
&_static_true {
|
|
98
|
-
position:
|
|
98
|
+
position: relative;
|
|
99
|
+
z-index: inherit;
|
|
99
100
|
display: block;
|
|
100
101
|
width: auto;
|
|
101
102
|
height: auto;
|
|
@@ -104,6 +105,7 @@
|
|
|
104
105
|
|
|
105
106
|
&_static_true &__panel {
|
|
106
107
|
position: relative;
|
|
108
|
+
z-index: inherit;
|
|
107
109
|
top: auto !important;
|
|
108
110
|
left: auto !important;
|
|
109
111
|
width: 100% !important;
|
|
@@ -323,3 +325,9 @@
|
|
|
323
325
|
display: none;
|
|
324
326
|
}
|
|
325
327
|
}
|
|
328
|
+
|
|
329
|
+
.jodit-dialog {
|
|
330
|
+
.jodit-ui-messages {
|
|
331
|
+
z-index: var(--z-index-dialog);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -45,6 +45,7 @@ import { eventEmitter, pluginSystem } from 'jodit/core/global';
|
|
|
45
45
|
import { component, autobind, hook } from 'jodit/core/decorators';
|
|
46
46
|
import { View } from 'jodit/core/view/view';
|
|
47
47
|
import { Icon } from 'jodit/core/ui';
|
|
48
|
+
import { UIMessages } from '../messages/messages';
|
|
48
49
|
|
|
49
50
|
declare module 'jodit/config' {
|
|
50
51
|
interface Config {
|
|
@@ -66,7 +67,11 @@ Config.prototype.dialog = {
|
|
|
66
67
|
*/
|
|
67
68
|
draggable: true,
|
|
68
69
|
buttons: ['dialog.close'],
|
|
69
|
-
removeButtons: []
|
|
70
|
+
removeButtons: [],
|
|
71
|
+
|
|
72
|
+
toolbarButtonSize: 'middle',
|
|
73
|
+
|
|
74
|
+
zIndex: 'inherit'
|
|
70
75
|
};
|
|
71
76
|
|
|
72
77
|
Config.prototype.controls.dialog = {
|
|
@@ -495,6 +500,8 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
495
500
|
* Sets the maximum z-index dialog box, displaying it on top of all the dialog boxes
|
|
496
501
|
*/
|
|
497
502
|
setMaxZIndex(): void {
|
|
503
|
+
if (this.getMod('static')) return;
|
|
504
|
+
|
|
498
505
|
let maxZIndex: number = 20000004,
|
|
499
506
|
zIndex: number = 0;
|
|
500
507
|
|
|
@@ -582,9 +589,12 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
582
589
|
|
|
583
590
|
this.destination.appendChild(this.container);
|
|
584
591
|
|
|
585
|
-
this.
|
|
586
|
-
|
|
587
|
-
|
|
592
|
+
if (this.getMod('static') !== true) {
|
|
593
|
+
this.setPosition(this.offsetX, this.offsetY);
|
|
594
|
+
this.setMaxZIndex();
|
|
595
|
+
} else {
|
|
596
|
+
this.container.style.removeProperty('z-index');
|
|
597
|
+
}
|
|
588
598
|
|
|
589
599
|
if (this.o.fullsize) {
|
|
590
600
|
this.toggleFullSize(true);
|
|
@@ -677,20 +687,14 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
677
687
|
return this;
|
|
678
688
|
}
|
|
679
689
|
|
|
680
|
-
constructor(options
|
|
690
|
+
constructor(options: Partial<IDialogOptions> = {}) {
|
|
681
691
|
super(options);
|
|
682
692
|
|
|
683
693
|
const self: Dialog = this;
|
|
684
694
|
|
|
685
695
|
self.options = ConfigProto(
|
|
686
|
-
options
|
|
687
|
-
|
|
688
|
-
ConfigProto(
|
|
689
|
-
{
|
|
690
|
-
toolbarButtonSize: 'middle'
|
|
691
|
-
},
|
|
692
|
-
ConfigProto(Config.prototype.dialog, View.defaultOptions)
|
|
693
|
-
)
|
|
696
|
+
options,
|
|
697
|
+
ConfigProto(Config.prototype.dialog, View.defaultOptions)
|
|
694
698
|
) as IDialogOptions;
|
|
695
699
|
|
|
696
700
|
Dom.safeRemove(self.container);
|
|
@@ -698,9 +702,7 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
698
702
|
const n = this.getFullElName.bind(this);
|
|
699
703
|
|
|
700
704
|
self.container = this.c.fromHTML(
|
|
701
|
-
`<div
|
|
702
|
-
this.componentName
|
|
703
|
-
}">
|
|
705
|
+
`<div class="jodit jodit-dialog ${this.componentName}">
|
|
704
706
|
<div class="${n('overlay')}"></div>
|
|
705
707
|
<div class="${this.getFullElName('panel')}">
|
|
706
708
|
<div class="${n('header')}">
|
|
@@ -714,6 +716,10 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
714
716
|
</div>`
|
|
715
717
|
) as HTMLDivElement;
|
|
716
718
|
|
|
719
|
+
if (this.o.zIndex) {
|
|
720
|
+
this.container.style.zIndex = this.o.zIndex.toString();
|
|
721
|
+
}
|
|
722
|
+
|
|
717
723
|
attr(self.container, 'role', 'dialog');
|
|
718
724
|
|
|
719
725
|
Object.defineProperty(self.container, 'component', {
|
|
@@ -746,6 +752,9 @@ export class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
746
752
|
'header-toolbar element does not exist'
|
|
747
753
|
);
|
|
748
754
|
|
|
755
|
+
this.message.destruct();
|
|
756
|
+
this.message = new UIMessages(this, dialog);
|
|
757
|
+
|
|
749
758
|
this.dialog = dialog;
|
|
750
759
|
this.resizer = resizer;
|
|
751
760
|
this.dialogbox_header = dialogbox_header;
|
|
@@ -190,14 +190,12 @@ export default class DataProvider implements IFileBrowserDataProvider {
|
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
* Load items list by path and source
|
|
195
|
-
*/
|
|
196
|
-
items(
|
|
193
|
+
private __items<Result>(
|
|
197
194
|
path: string,
|
|
198
195
|
source: string,
|
|
199
|
-
mods: IFileBrowserDataProviderItemsMods
|
|
200
|
-
|
|
196
|
+
mods: IFileBrowserDataProviderItemsMods,
|
|
197
|
+
onResult: (resp: IFileBrowserAnswer) => Result
|
|
198
|
+
): Promise<Result> {
|
|
201
199
|
const opt = this.options;
|
|
202
200
|
|
|
203
201
|
if (!opt.items) {
|
|
@@ -220,10 +218,40 @@ export default class DataProvider implements IFileBrowserDataProvider {
|
|
|
220
218
|
resp = process.call(self, resp);
|
|
221
219
|
}
|
|
222
220
|
|
|
223
|
-
return
|
|
221
|
+
return onResult(resp);
|
|
224
222
|
});
|
|
225
223
|
}
|
|
226
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Load items list by path and source
|
|
227
|
+
*/
|
|
228
|
+
items(
|
|
229
|
+
path: string,
|
|
230
|
+
source: string,
|
|
231
|
+
mods: IFileBrowserDataProviderItemsMods = {}
|
|
232
|
+
): Promise<IFileBrowserItem[]> {
|
|
233
|
+
return this.__items(path, source, mods, resp =>
|
|
234
|
+
this.generateItemsList(resp.data.sources, mods)
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Load items list by path and source
|
|
240
|
+
*/
|
|
241
|
+
itemsEx(
|
|
242
|
+
path: string,
|
|
243
|
+
source: string,
|
|
244
|
+
mods: IFileBrowserDataProviderItemsMods = {}
|
|
245
|
+
): ReturnType<IFileBrowserDataProvider['itemsEx']> {
|
|
246
|
+
const calcTotal = (sources: ISourcesFiles): number =>
|
|
247
|
+
sources.reduce((acc, source) => acc + source.files.length, 0);
|
|
248
|
+
|
|
249
|
+
return this.__items(path, source, mods, resp => ({
|
|
250
|
+
items: this.generateItemsList(resp.data.sources, mods),
|
|
251
|
+
loadedTotal: calcTotal(resp.data.sources)
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
|
|
227
255
|
private generateItemsList(
|
|
228
256
|
sources: ISourcesFiles,
|
|
229
257
|
mods: IFileBrowserDataProviderItemsMods = {}
|
|
@@ -231,11 +259,15 @@ export default class DataProvider implements IFileBrowserDataProvider {
|
|
|
231
259
|
const elements: IFileBrowserItem[] = [];
|
|
232
260
|
|
|
233
261
|
const canBeFile = (item: ISourceFile): boolean =>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
262
|
+
item.type === 'folder' ||
|
|
263
|
+
!mods.onlyImages ||
|
|
264
|
+
item.isImage === undefined ||
|
|
265
|
+
item.isImage;
|
|
266
|
+
|
|
267
|
+
const inFilter = (item: ISourceFile): boolean =>
|
|
268
|
+
!mods.filterWord?.length ||
|
|
269
|
+
this.o.filter === undefined ||
|
|
270
|
+
this.o.filter(item, mods.filterWord);
|
|
239
271
|
|
|
240
272
|
sources.forEach(source => {
|
|
241
273
|
if (source.files && source.files.length) {
|