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.
Files changed (175) hide show
  1. package/README.md +4 -4
  2. package/build/jodit.css +8 -3
  3. package/build/jodit.es2018.css +7 -2
  4. package/build/jodit.es2018.en.css +7 -2
  5. package/build/jodit.es2018.en.js +8384 -7869
  6. package/build/jodit.es2018.en.min.css +1 -1
  7. package/build/jodit.es2018.en.min.js +1 -1
  8. package/build/jodit.es2018.js +8384 -7869
  9. package/build/jodit.es2018.min.css +1 -1
  10. package/build/jodit.es2018.min.js +1 -1
  11. package/build/jodit.js +2954 -2414
  12. package/build/jodit.min.css +2 -2
  13. package/build/jodit.min.js +1 -1
  14. package/build/plugins/debug/debug.es2018.en.js +8 -8
  15. package/build/plugins/debug/debug.es2018.en.min.js +1 -1
  16. package/build/plugins/debug/debug.es2018.js +8 -8
  17. package/build/plugins/debug/debug.es2018.min.js +1 -1
  18. package/build/plugins/debug/debug.js +8 -8
  19. package/build/plugins/debug/debug.min.js +1 -1
  20. package/build/plugins/speech-recognize/speech-recognize.css +1 -1
  21. package/build/plugins/speech-recognize/speech-recognize.es2018.css +1 -1
  22. package/build/plugins/speech-recognize/speech-recognize.es2018.en.css +1 -1
  23. package/build/plugins/speech-recognize/speech-recognize.es2018.en.js +38 -38
  24. package/build/plugins/speech-recognize/speech-recognize.es2018.en.min.js +1 -1
  25. package/build/plugins/speech-recognize/speech-recognize.es2018.js +38 -38
  26. package/build/plugins/speech-recognize/speech-recognize.es2018.min.js +1 -1
  27. package/build/plugins/speech-recognize/speech-recognize.js +30 -30
  28. package/build/plugins/speech-recognize/speech-recognize.min.js +1 -1
  29. package/build/vdom.css +12 -1
  30. package/build/vdom.js +1445 -41
  31. package/package.json +23 -23
  32. package/src/core/constants.ts +10 -8
  33. package/src/core/dom/dom.test.js +25 -0
  34. package/src/core/dom/dom.ts +90 -41
  35. package/src/core/helpers/checker/has-browser-color-picker.ts +2 -2
  36. package/src/core/helpers/checker/index.ts +1 -0
  37. package/src/core/helpers/checker/is-boolean.ts +1 -1
  38. package/src/core/helpers/checker/is-marker.ts +20 -0
  39. package/src/core/helpers/normalize/normalize-css-value.ts +19 -0
  40. package/src/core/helpers/normalize/normalize-node.ts +2 -2
  41. package/src/core/helpers/size/position.test.js +198 -187
  42. package/src/core/helpers/utils/css.ts +7 -14
  43. package/src/core/plugin/plugin.ts +1 -1
  44. package/src/core/selection/interface.ts +24 -0
  45. package/src/core/selection/select.ts +69 -29
  46. package/src/core/selection/selection.test.js +5 -17
  47. package/src/core/selection/style/api/extract.ts +6 -7
  48. package/src/core/selection/style/api/finite-state-machine.ts +40 -35
  49. package/src/core/selection/style/api/get-suit-child.ts +3 -4
  50. package/src/core/selection/style/api/get-suit-parent.ts +3 -4
  51. package/src/core/selection/style/api/{element-has-same-style.ts → has-same-style.ts} +25 -6
  52. package/src/core/selection/style/api/index.ts +6 -6
  53. package/src/core/selection/style/api/is-inside-invisible-element.ts +1 -1
  54. package/src/core/selection/style/api/is-normal-node.ts +3 -3
  55. package/src/core/selection/style/api/is-same-attributes.ts +56 -0
  56. package/src/core/selection/style/api/is-suit-element.ts +22 -12
  57. package/src/core/selection/style/api/list/toggle-ordered-list.ts +100 -0
  58. package/src/core/selection/style/api/list/wrap-list.ts +71 -0
  59. package/src/core/selection/style/api/toggle-attributes.ts +251 -0
  60. package/src/core/selection/style/api/unwrap-children.ts +10 -8
  61. package/src/core/selection/style/api/wrap-unwrapped-text.ts +7 -8
  62. package/src/core/selection/style/api/{wrap-and-commit-style.ts → wrap.ts} +8 -11
  63. package/src/core/selection/style/apply-style.ts +32 -181
  64. package/src/core/selection/style/commit-style.ts +79 -4
  65. package/src/core/selection/style/style.test.js +457 -128
  66. package/src/core/selection/style/transactions.ts +256 -0
  67. package/src/core/ui/button/tooltip/tooltip.test.js +95 -76
  68. package/src/core/ui/popup/popup.test.js +158 -153
  69. package/src/{plugins/backspace/interface.d.ts → core/vdom/on-demand.ts} +7 -5
  70. package/src/core/vdom/render/index.ts +2 -4
  71. package/src/core/vdom/render/patcher.ts +14 -0
  72. package/src/core/vdom/v-dom-jodit.less +17 -0
  73. package/src/core/vdom/v-dom-jodit.ts +102 -3
  74. package/src/core/view/view.ts +2 -2
  75. package/src/index.ts +2 -0
  76. package/src/jodit.ts +5 -1
  77. package/src/langs/i18n.test.js +221 -216
  78. package/src/modules/dialog/dialog.less +9 -1
  79. package/src/modules/dialog/dialog.ts +25 -16
  80. package/src/modules/file-browser/data-provider.ts +44 -12
  81. package/src/modules/file-browser/file-browser.test.js +1019 -958
  82. package/src/modules/file-browser/file-browser.ts +0 -1
  83. package/src/modules/messages/messages.ts +3 -8
  84. package/src/plugins/backspace/backspace.test.js +2 -9
  85. package/src/plugins/backspace/backspace.ts +5 -0
  86. package/src/plugins/backspace/cases/check-join-neighbors.ts +7 -1
  87. package/src/plugins/backspace/cases/check-join-two-lists.ts +2 -1
  88. package/src/plugins/backspace/helpers.ts +9 -1
  89. package/src/plugins/backspace/interface.ts +31 -0
  90. package/src/plugins/clean-html/helpers/visitor/filters/fill-empty-paragraph.ts +2 -1
  91. package/src/plugins/color/color.test.js +122 -119
  92. package/src/plugins/enter/enter.test.js +18 -5
  93. package/src/plugins/enter/enter.ts +9 -5
  94. package/src/plugins/enter/interface.ts +41 -0
  95. package/src/plugins/font/config.ts +8 -8
  96. package/src/plugins/font/font.test.js +18 -23
  97. package/src/plugins/hotkeys/hotkeys.test.js +35 -47
  98. package/src/plugins/iframe/iframe.test.js +206 -195
  99. package/src/plugins/image/image.ts +1 -1
  100. package/src/plugins/image-properties/config.ts +22 -0
  101. package/src/plugins/image-properties/image-properties.test.js +174 -93
  102. package/src/plugins/image-properties/templates/position-tab.ts +22 -1
  103. package/src/plugins/indent/indent.test.js +2 -8
  104. package/src/plugins/link/link.test.js +19 -0
  105. package/src/plugins/link/link.ts +25 -15
  106. package/src/plugins/placeholder/placeholder.ts +8 -7
  107. package/src/plugins/size/size.test.js +239 -225
  108. package/src/plugins/tab/cases/on-tab-inside-li.ts +131 -22
  109. package/src/plugins/tab/tab.test.js +95 -11
  110. package/src/plugins/tab/tab.ts +22 -2
  111. package/src/plugins/wrap-nodes/config.ts +11 -0
  112. package/src/plugins/wrap-nodes/wrap-nodes.ts +0 -1
  113. package/src/types/events.d.ts +4 -0
  114. package/src/types/file-browser.d.ts +17 -10
  115. package/src/types/select.d.ts +6 -1
  116. package/src/types/style.d.ts +72 -5
  117. package/src/types/uploader.d.ts +14 -0
  118. package/src/types/view.d.ts +2 -2
  119. package/types/core/async/async.d.ts +1 -1
  120. package/types/core/constants.d.ts +3 -3
  121. package/types/core/dom/dom.d.ts +6 -3
  122. package/types/core/helpers/checker/index.d.ts +1 -0
  123. package/types/core/helpers/checker/is-boolean.d.ts +1 -1
  124. package/types/core/helpers/checker/is-marker.d.ts +10 -0
  125. package/types/core/helpers/html/safe-html.d.ts +1 -1
  126. package/types/core/helpers/normalize/normalize-css-value.d.ts +2 -0
  127. package/types/core/helpers/normalize/normalize-node.d.ts +1 -1
  128. package/types/core/helpers/utils/append-script.d.ts +1 -1
  129. package/types/core/selection/interface.d.ts +19 -0
  130. package/types/core/selection/select.d.ts +22 -5
  131. package/types/core/selection/style/api/finite-state-machine.d.ts +10 -9
  132. package/types/core/selection/style/api/get-suit-child.d.ts +2 -3
  133. package/types/core/selection/style/api/get-suit-parent.d.ts +2 -3
  134. package/types/core/selection/style/api/{element-has-same-style.d.ts → has-same-style.d.ts} +2 -2
  135. package/types/core/selection/style/api/index.d.ts +6 -6
  136. package/types/core/selection/style/api/is-same-attributes.d.ts +12 -0
  137. package/types/core/selection/style/api/is-suit-element.d.ts +4 -4
  138. package/types/core/selection/style/api/{toggle → list}/toggle-ordered-list.d.ts +2 -3
  139. package/types/core/selection/style/api/{wrap-ordered-list.d.ts → list/wrap-list.d.ts} +2 -3
  140. package/types/core/selection/style/api/toggle-attributes.d.ts +11 -0
  141. package/types/core/selection/style/api/unwrap-children.d.ts +2 -2
  142. package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -3
  143. package/types/core/selection/style/api/{wrap-and-commit-style.d.ts → wrap.d.ts} +2 -3
  144. package/types/core/selection/style/apply-style.d.ts +3 -3
  145. package/types/core/selection/style/commit-style.d.ts +6 -2
  146. package/types/core/selection/style/transactions.d.ts +29 -0
  147. package/types/core/ui/popup/popup.d.ts +1 -1
  148. package/types/core/view/view.d.ts +1 -1
  149. package/types/index.d.ts +2 -0
  150. package/types/modules/file-browser/builders/elements-map.d.ts +1 -1
  151. package/types/modules/file-browser/data-provider.d.ts +5 -0
  152. package/types/modules/messages/messages.d.ts +2 -1
  153. package/types/plugins/backspace/helpers.d.ts +5 -1
  154. package/types/plugins/backspace/interface.d.ts +21 -0
  155. package/types/plugins/enter/enter.d.ts +2 -0
  156. package/types/plugins/enter/interface.d.ts +32 -0
  157. package/types/plugins/image-properties/config.d.ts +19 -0
  158. package/types/plugins/link/link.d.ts +1 -1
  159. package/types/plugins/paste/interface.d.ts +2 -2
  160. package/types/plugins/tab/cases/on-tab-inside-li.d.ts +1 -1
  161. package/types/plugins/wrap-nodes/config.d.ts +10 -0
  162. package/types/types/events.d.ts +4 -0
  163. package/types/types/file-browser.d.ts +17 -10
  164. package/types/types/select.d.ts +6 -1
  165. package/types/types/storage.d.ts +1 -1
  166. package/types/types/style.d.ts +72 -5
  167. package/types/types/uploader.d.ts +14 -0
  168. package/types/types/view.d.ts +2 -2
  169. package/vdom.html +20 -0
  170. package/src/core/selection/style/api/toggle/toggle-css.ts +0 -136
  171. package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +0 -54
  172. package/src/core/selection/style/api/toggle-commit-styles.ts +0 -35
  173. package/src/core/selection/style/api/wrap-ordered-list.ts +0 -42
  174. package/types/core/selection/style/api/toggle/toggle-css.d.ts +0 -12
  175. package/types/core/selection/style/api/toggle-commit-styles.d.ts +0 -13
@@ -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
- describe('Test i18n functionality', function () {
7
- describe('Helper 18n', function () {
8
- const i18n = Jodit.modules.Helpers.i18n;
9
-
10
- describe('Put defined sentence', function () {
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 some information inside sentence', function () {
53
- it('Should put this information inside new sentence', function () {
12
+ describe('Put defined sentence', function () {
13
+ it('Should replace it on defined language', function () {
54
14
  const values = [
55
- 'Chars: %d',
56
- 'Символов: 1',
15
+ 'Type something',
16
+ 'Напишите что-либо',
57
17
  'ru',
58
- [1],
59
- 'Select %s',
60
- 'Выделить: Test',
61
- 'ru',
62
- ['Test'],
63
- 'select %s',
64
- 'Выделить: Test',
18
+
19
+ 'rename',
20
+ 'Переименовать',
65
21
  'ru',
66
- ['Test'],
67
- 'Bla %d Bla %s',
68
- 'Bla 1 Bla boo',
22
+
23
+ 'Rename',
24
+ 'Переименовать',
69
25
  'ru',
70
- [1, 'boo'],
71
- 'Bla %d Bla %s',
72
- 'Bla 1 Bla boo',
73
- 'ru1',
74
- [1, 'boo']
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 += 4) {
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
- values[i + 3],
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
- const values = [
94
- 'Type something',
95
- 'Напишите что-либо',
96
- 'ru',
97
-
98
- 'About Jodit',
99
- 'حول جوديت',
100
- 'ar',
101
-
102
- 'About Jodit',
103
- '{About Jodit}',
104
- 'ar1',
105
-
106
- 'British people',
107
- '{British people}',
108
- 'ar'
109
- ];
110
-
111
- for (let i = 0; i < values.length; i += 3) {
112
- const [source, result, language] = [
113
- values[i],
114
- values[i + 1],
115
- values[i + 2]
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
- describe(`Debug mode for ${language}`, function () {
119
- it(`Should show debug brackets for undefined keys for source ${source}`, function () {
120
- expect(result).equals(
121
- i18n(
122
- source,
123
- [],
124
- {
125
- language,
126
- debugLanguage: true
127
- },
128
- true
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
- describe('Define i18n property inside input options', function () {
136
- it('Should use it', function () {
137
- const values = [
138
- 'Type something',
139
- 'Привет',
140
- 'ru',
141
- 'About Jodit',
142
- 'جوديت',
143
- 'ar',
144
- 'British people',
145
- 'Bond',
146
- 'ar'
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
- const opt = {
150
- ru: {
151
- 'Type something': 'Привет'
152
- },
153
- ar: {
154
- 'About Jodit': 'جوديت',
155
- 'British people': 'Bond'
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
- describe('Test has keys in all functionality', function () {
178
- const filter = [
179
- 'customxxx',
180
- 'customxxx',
181
- 'lineHeight',
182
- 'Ok',
183
- 'Link',
184
- 'Code',
185
- 'Embed code',
186
- 'Normal',
187
- 'Text',
188
- 'Split',
189
- 'Jodit Editor',
190
- 'License: %s',
191
- 'Split vertical',
192
- 'Src',
193
- 'Edit',
194
- 'Split horizontal',
195
- 'Styles',
196
- 'Classes',
197
- 'Alternative',
198
- 'Image',
199
- 'spellcheck',
200
- 'Border'
201
- ];
202
-
203
- Object.keys(Jodit.lang)
204
- .filter(function (language) {
205
- return language !== 'en';
206
- })
207
- .forEach(function (language) {
208
- it(
209
- 'Should have value for all key in ' +
210
- language +
211
- ' language',
212
- function () {
213
- const editor = getJodit({
214
- language: language,
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: static;
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.setPosition(this.offsetX, this.offsetY);
586
-
587
- this.setMaxZIndex();
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?: Partial<IDialogOptions>) {
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 style="z-index:${self.o.zIndex}" class="jodit jodit-dialog ${
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
- ): Promise<IFileBrowserItem[]> {
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 this.generateItemsList(resp.data.sources, mods);
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
- !mods.onlyImages || item.isImage === undefined || item.isImage,
235
- inFilter = (item: ISourceFile): boolean =>
236
- !mods.filterWord?.length ||
237
- this.o.filter === undefined ||
238
- this.o.filter(item, mods.filterWord);
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) {