jodit 3.8.1 → 3.8.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/.idea/codeStyles/Project.xml +68 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/dictionaries/v_chupurnov.xml +10 -0
- package/.idea/encodings.xml +4 -0
- package/.idea/inspectionProfiles/Project_Default.xml +118 -0
- package/.idea/jodit.iml +12 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/markdown-navigator-enh.xml +29 -0
- package/.idea/markdown-navigator.xml +55 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/watcherTasks.xml +4 -0
- package/.idea/workspace.xml +1264 -0
- package/build/jodit.css +2 -2
- package/build/jodit.es2018.css +1 -1
- package/build/jodit.es2018.en.css +1 -1
- package/build/jodit.es2018.en.js +4 -4
- package/build/jodit.es2018.en.min.js +2 -2
- package/build/jodit.es2018.js +4 -4
- package/build/jodit.es2018.min.js +2 -2
- package/build/jodit.js +4 -4
- package/build/jodit.min.css +1 -1
- package/build/jodit.min.js +2 -2
- package/package.json +2 -2
- package/.travis.yml +0 -7
- package/bower.json +0 -33
- package/build.js +0 -39
- package/docker/Dockerfile +0 -11
- package/docker/README.md +0 -45
- package/docker/build +0 -3
- package/docker/install +0 -7
- package/docker/start +0 -3
- package/docker/test +0 -3
- package/docker/uninstall +0 -3
- package/examples/arabic.lang.html +0 -76
- package/examples/assets/app.css +0 -175
- package/examples/assets/app.js +0 -57
- package/examples/assets/download.jpg +0 -0
- package/examples/assets/icon.png +0 -0
- package/examples/assets/logo.png +0 -0
- package/examples/assets/prism.css +0 -200
- package/examples/assets/prism.js +0 -1254
- package/examples/color-picker.html +0 -139
- package/examples/custom-icons.html +0 -173
- package/examples/custom-toolbar.html +0 -80
- package/examples/example.default.html +0 -75
- package/examples/fullsize.html +0 -75
- package/examples/index.html +0 -176
- package/examples/inline-mode.html +0 -116
- package/examples/oneinstance.html +0 -125
- package/icons.html +0 -50
- package/karma.conf.js +0 -157
- package/make.js +0 -10
- package/server.js +0 -101
- package/test/bootstrap.js +0 -1167
- package/test/test.html +0 -102
- package/test/test.index.html +0 -11
- package/test/tests/acceptance/clipboardTest.js +0 -1234
- package/test/tests/acceptance/commandsTest.js +0 -647
- package/test/tests/acceptance/creatorTest.js +0 -103
- package/test/tests/acceptance/deleteBackSpaceTest.js +0 -1289
- package/test/tests/acceptance/dialogTest.js +0 -188
- package/test/tests/acceptance/editorTest.js +0 -855
- package/test/tests/acceptance/enterTest.js +0 -1088
- package/test/tests/acceptance/eventsTest.js +0 -1246
- package/test/tests/acceptance/filebrowserTest.js +0 -1309
- package/test/tests/acceptance/i18nTest.js +0 -81
- package/test/tests/acceptance/iframeTest.js +0 -306
- package/test/tests/acceptance/imageTest.js +0 -1649
- package/test/tests/acceptance/inlineModeTest.js +0 -826
- package/test/tests/acceptance/interfaceTest.js +0 -119
- package/test/tests/acceptance/mobileTest.js +0 -229
- package/test/tests/acceptance/plugins/classSpan.js +0 -220
- package/test/tests/acceptance/plugins/cleanHtml.js +0 -351
- package/test/tests/acceptance/plugins/color.js +0 -188
- package/test/tests/acceptance/plugins/dragAndDropElement.js +0 -172
- package/test/tests/acceptance/plugins/focus.js +0 -115
- package/test/tests/acceptance/plugins/font.js +0 -316
- package/test/tests/acceptance/plugins/image.js +0 -79
- package/test/tests/acceptance/plugins/indent.js +0 -179
- package/test/tests/acceptance/plugins/inline-popup.js +0 -578
- package/test/tests/acceptance/plugins/insert.js +0 -17
- package/test/tests/acceptance/plugins/limit.js +0 -164
- package/test/tests/acceptance/plugins/link.js +0 -1640
- package/test/tests/acceptance/plugins/orderedList.js +0 -290
- package/test/tests/acceptance/plugins/placeholder.js +0 -138
- package/test/tests/acceptance/plugins/resizer.js +0 -329
- package/test/tests/acceptance/plugins/search.js +0 -623
- package/test/tests/acceptance/plugins/size.js +0 -344
- package/test/tests/acceptance/plugins/source.js +0 -218
- package/test/tests/acceptance/plugins/stat.js +0 -120
- package/test/tests/acceptance/plugins/tooltip.js +0 -97
- package/test/tests/acceptance/plugins/wrapTextNodes.js +0 -105
- package/test/tests/acceptance/pluginsTest.js +0 -2219
- package/test/tests/acceptance/selectionTest.js +0 -862
- package/test/tests/acceptance/statesTest.js +0 -310
- package/test/tests/acceptance/tableTest.js +0 -1988
- package/test/tests/acceptance/toolbarTest.js +0 -1747
- package/test/tests/acceptance/undoredoTest.js +0 -217
- package/test/tests/acceptance/uploaderTest.js +0 -187
- package/test/tests/artio.jpg +0 -0
- package/test/tests/units/helpersTest.js +0 -771
- package/test/tests/units/modules/dom.js +0 -282
- package/test/tests/units/objectObserverTest.js +0 -533
- package/test/tests/units/popupTest.js +0 -211
- package/test/tests/units/positionTest.js +0 -238
- package/test/tests/units/styleTest.js +0 -1361
- package/webpack.config.js +0 -308
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
describe('Clean html plugin', function () {
|
|
7
|
-
describe('Click remove format button', function () {
|
|
8
|
-
describe('For range selection', function () {
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
'start <span style="background-color: red; color: blue;">test test test|</span>',
|
|
12
|
-
'start <span style="background-color: red; color: blue;">test test test</span> pop ',
|
|
13
|
-
' pop '
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
'|<a href="#test">start</a> <span style="background-color: red; color: blue;">test test test|</span>',
|
|
18
|
-
'start test test test'
|
|
19
|
-
],
|
|
20
|
-
|
|
21
|
-
[
|
|
22
|
-
'start <strong>test test test|</strong>',
|
|
23
|
-
'start <strong>test test test</strong> pop ',
|
|
24
|
-
' pop '
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
[
|
|
28
|
-
'start <strong><em>test test test|</em></strong>',
|
|
29
|
-
'start <strong><em>test test test</em></strong> pop ',
|
|
30
|
-
' pop '
|
|
31
|
-
],
|
|
32
|
-
|
|
33
|
-
[
|
|
34
|
-
'start <strong><em>test test| test</em></strong>',
|
|
35
|
-
'start <strong><em>test test</em></strong> pop <strong><em> test</em></strong>',
|
|
36
|
-
' pop '
|
|
37
|
-
],
|
|
38
|
-
[
|
|
39
|
-
'<p>as<strong>da</strong>sd</p>' +
|
|
40
|
-
'<p>asd<strong>as</strong>d</p>' +
|
|
41
|
-
'<p>a<strong>sdsad</strong>a</p>',
|
|
42
|
-
|
|
43
|
-
'<p>asdasd</p><p>asdasd</p><p>asdsada</p>'
|
|
44
|
-
],
|
|
45
|
-
[
|
|
46
|
-
'<p>fo|ur <strong style="background-color: red; color: blue;">about <span style="align-content: baseline;">rust blog| go</span>st</strong> elm</p>',
|
|
47
|
-
|
|
48
|
-
'<p>four about rust blog<strong style="background-color: red; color: blue;"><span style="align-content: baseline;"> go</span>st</strong> elm</p>'
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
'<p>four <strong style="background-color: red; color: blue;">ab|out <span style="align-content: baseline;">rust blog| go</span>st</strong> elm</p>',
|
|
52
|
-
|
|
53
|
-
'<p>four <strong style="background-color: red; color: blue;">ab</strong>' +
|
|
54
|
-
'out rust blog' +
|
|
55
|
-
'<strong style="background-color:red;color:blue"><span style="align-content:baseline"> go</span>st</strong> elm</p>'
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
'<p>four <strong style="background-color: red; color: blue;"><span style="align-content: baseline;">rust |blog| go</span>st</strong> elm</p>',
|
|
59
|
-
|
|
60
|
-
'<p>four <strong style="background-color: red; color: blue;"><span style="align-content: baseline;">rust </span></strong>' +
|
|
61
|
-
'blog' +
|
|
62
|
-
'<strong style="background-color:red;color:blue"><span style="align-content:baseline"> go</span>st</strong> elm</p>'
|
|
63
|
-
],
|
|
64
|
-
[
|
|
65
|
-
'<p>f|ive <strong style="background-color: red; color: blue;">one two three</strong> elm</p>' +
|
|
66
|
-
'<p>five <strong style="background-color: red; color: blue;">one| d</strong>two</p>',
|
|
67
|
-
|
|
68
|
-
'<p>five one two three elm</p><p>five one<strong style="background-color: red; color: blue;"> d</strong>two</p>'
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
'<p>f|ive <strong style="background-color: red; color: blue;">one two three</strong> elm</p>' +
|
|
72
|
-
'<p>five <strong style="background-color: red; color: blue;">one|</strong>two</p>',
|
|
73
|
-
|
|
74
|
-
'<p>five one two three elm</p>' + '<p>five onetwo</p>'
|
|
75
|
-
],
|
|
76
|
-
[
|
|
77
|
-
'<p>five <strong style="background-color: red; color: blue;">one |two three</strong> elm</p>' +
|
|
78
|
-
'<p>five <strong style="background-color: red; color: blue;">one|</strong>two</p>',
|
|
79
|
-
|
|
80
|
-
'<p>five <strong style="background-color: red; color: blue;">one </strong>two three elm</p>' +
|
|
81
|
-
'<p>five onetwo</p>'
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
'<p>five <strong style="background-color: red; color: blue;">one |two| three</strong> elm</p>',
|
|
85
|
-
|
|
86
|
-
'<p>five <strong style="background-color: red; color: blue;">one </strong>' +
|
|
87
|
-
'two' +
|
|
88
|
-
'<strong style="background-color: red; color: blue;"> three</strong> elm</p>'
|
|
89
|
-
],
|
|
90
|
-
[
|
|
91
|
-
'one <span style="background-color: red; color: blue;">|test test test|</span> elm',
|
|
92
|
-
'one test test test elm'
|
|
93
|
-
],
|
|
94
|
-
[
|
|
95
|
-
'<p style="color: red">|one <span style="background-color: red; color: blue;">test test test</span> elm|</p>',
|
|
96
|
-
'<p>one test test test elm</p>'
|
|
97
|
-
],
|
|
98
|
-
[
|
|
99
|
-
'<p style="color: red">one |<span style="background-color: red; color: blue;">test test test</span> elm|</p>',
|
|
100
|
-
'<p style="color:red">one test test test elm</p>'
|
|
101
|
-
],
|
|
102
|
-
[
|
|
103
|
-
'two |<strong style="background-color: red; color: blue;">test test test</strong>| elm',
|
|
104
|
-
'two test test test elm'
|
|
105
|
-
],
|
|
106
|
-
[
|
|
107
|
-
'<p><strong><em><u>as<span style="color: rgb(26, 188, 156);">da</span>s<span style="font-family: Impact,Charcoal,sans-serif;">da</span></u></em></strong><a href="https://xdan.ru/copysite/?lang=en"><strong><em><u><span style="font-family: Impact,Charcoal,sans-serif;">sds</span>a</u></em></strong></a><strong><em><u><s>d</s></u></em></strong></p>\n',
|
|
108
|
-
'<p>asdasdasdsad</p>\n'
|
|
109
|
-
]
|
|
110
|
-
].forEach(function (test) {
|
|
111
|
-
describe(`For "${test[0]}"`, function () {
|
|
112
|
-
it(`Should clean to "${sortAttributes(
|
|
113
|
-
test[1]
|
|
114
|
-
)}"`, function () {
|
|
115
|
-
const editor = getJodit({
|
|
116
|
-
disablePlugins: ['WrapTextNodes']
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
const button = getButton('eraser', editor);
|
|
120
|
-
editor.value = test[0];
|
|
121
|
-
|
|
122
|
-
if (!setCursorToChar(editor)) {
|
|
123
|
-
const range = editor.s.createRange();
|
|
124
|
-
range.selectNodeContents(editor.editor);
|
|
125
|
-
editor.s.selectRange(range);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
simulateEvent('click', button);
|
|
129
|
-
|
|
130
|
-
if (test[2]) {
|
|
131
|
-
editor.s.insertHTML(test[2]);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
expect(sortAttributes(editor.value)).equals(
|
|
135
|
-
sortAttributes(test[1])
|
|
136
|
-
);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// describe('For collapsed selection', function () {
|
|
143
|
-
// it('Should move cursor outside from styled element', function () {
|
|
144
|
-
// const editor = getJodit({
|
|
145
|
-
// disablePlugins: ['WrapTextNodes']
|
|
146
|
-
// });
|
|
147
|
-
//
|
|
148
|
-
// [
|
|
149
|
-
//
|
|
150
|
-
// ].forEach(function (test) {
|
|
151
|
-
// editor.value = test[0];
|
|
152
|
-
//
|
|
153
|
-
// const range = editor.s.createRange();
|
|
154
|
-
// range.selectNodeContents(
|
|
155
|
-
// editor.editor.querySelector(test[1])
|
|
156
|
-
// );
|
|
157
|
-
// range.collapse(false);
|
|
158
|
-
//
|
|
159
|
-
// editor.s.selectRange(range);
|
|
160
|
-
//
|
|
161
|
-
// const button = getButton('eraser', editor);
|
|
162
|
-
//
|
|
163
|
-
// simulateEvent('click', 0, button);
|
|
164
|
-
//
|
|
165
|
-
// editor.s.insertHTML(' pop ');
|
|
166
|
-
//
|
|
167
|
-
// expect(editor.value).equals(test[2]);
|
|
168
|
-
// });
|
|
169
|
-
// });
|
|
170
|
-
// });
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
describe('Replace old tags', function () {
|
|
174
|
-
it('Should replace old tags to new', function () {
|
|
175
|
-
const editor = getJodit({
|
|
176
|
-
cleanHTML: {
|
|
177
|
-
timeout: 0
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
editor.value = 'test <b>old</b> test';
|
|
182
|
-
|
|
183
|
-
const range = editor.s.createRange(true);
|
|
184
|
-
range.setStart(editor.editor.querySelector('b').firstChild, 2);
|
|
185
|
-
range.collapse(true);
|
|
186
|
-
|
|
187
|
-
simulateEvent('mousedown', 0, editor.editor);
|
|
188
|
-
|
|
189
|
-
editor.s.insertHTML(' some ');
|
|
190
|
-
|
|
191
|
-
expect(editor.value).equals(
|
|
192
|
-
'<p>test <strong>ol some d</strong> test</p>'
|
|
193
|
-
);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
describe('Replace custom tags', function () {
|
|
197
|
-
it('Should replace tags', function () {
|
|
198
|
-
const editor = getJodit({
|
|
199
|
-
cleanHTML: {
|
|
200
|
-
replaceOldTags: {
|
|
201
|
-
p: 'div'
|
|
202
|
-
},
|
|
203
|
-
timeout: 0
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
editor.s.focus();
|
|
207
|
-
editor.value = '<p>test <b>ol|d</b> test</p>';
|
|
208
|
-
setCursorToChar(editor);
|
|
209
|
-
|
|
210
|
-
simulateEvent('mousedown', editor.editor);
|
|
211
|
-
|
|
212
|
-
editor.s.insertHTML(' some ');
|
|
213
|
-
|
|
214
|
-
expect(editor.value).equals(
|
|
215
|
-
'<div>test <strong>ol some d</strong> test</div>'
|
|
216
|
-
);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
describe('Disable', function () {
|
|
221
|
-
it('Should not replace old tags to new', function () {
|
|
222
|
-
const editor = getJodit({
|
|
223
|
-
cleanHTML: {
|
|
224
|
-
replaceOldTags: false,
|
|
225
|
-
timeout: 0
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
editor.value = 'test <b>old</b> test';
|
|
230
|
-
|
|
231
|
-
const range = editor.s.createRange(true);
|
|
232
|
-
range.setStart(editor.editor.querySelector('b').firstChild, 2);
|
|
233
|
-
range.collapse(true);
|
|
234
|
-
|
|
235
|
-
simulateEvent('mousedown', 0, editor.editor);
|
|
236
|
-
|
|
237
|
-
editor.s.insertHTML(' some ');
|
|
238
|
-
|
|
239
|
-
expect(editor.value).equals(
|
|
240
|
-
'<p>test <b>ol some d</b> test</p>'
|
|
241
|
-
);
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
describe('Deny tags', function () {
|
|
247
|
-
describe('Parameter like string', function () {
|
|
248
|
-
it('Should remove all tags in denyTags options', function () {
|
|
249
|
-
const editor = getJodit({
|
|
250
|
-
cleanHTML: {
|
|
251
|
-
denyTags: 'p'
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
editor.value = '<p>te<strong>stop</strong>st</p><h1>pop</h1>';
|
|
255
|
-
expect(editor.value).equals('<h1>pop</h1>');
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
describe('Allow tags', function () {
|
|
261
|
-
describe('Parameter like string', function () {
|
|
262
|
-
it('Should remove all tags not in allowTags options', function () {
|
|
263
|
-
const editor = getJodit({
|
|
264
|
-
cleanHTML: {
|
|
265
|
-
allowTags: 'p'
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
editor.value = '<p>te<strong>stop</strong>st</p><h1>pop</h1>';
|
|
269
|
-
expect(editor.value).equals('<p>test</p>');
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
describe('Parameter like hash', function () {
|
|
274
|
-
it('Should remove all tags not in allowTags options', function () {
|
|
275
|
-
const editor = getJodit({
|
|
276
|
-
cleanHTML: {
|
|
277
|
-
allowTags: {
|
|
278
|
-
p: true
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
editor.value = '<p>te<strong>stop</strong>st</p><h1>pop</h1>';
|
|
283
|
-
expect(editor.value).equals('<p>test</p>');
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
describe('Allow attributes', function () {
|
|
288
|
-
it('Should remove all attributes from element and remove not in allowTags options', function () {
|
|
289
|
-
const editor = getJodit({
|
|
290
|
-
cleanHTML: {
|
|
291
|
-
allowTags: {
|
|
292
|
-
p: {
|
|
293
|
-
style: true
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
editor.value =
|
|
299
|
-
'<p style="color: red;" data-id="111">te<strong>stop</strong>st</p><h1>pop</h1>';
|
|
300
|
-
expect(editor.value).equals('<p style="color: red;">test</p>');
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
describe('Time checking', function () {
|
|
305
|
-
it('Should work fast', function () {
|
|
306
|
-
const editor = getJodit({
|
|
307
|
-
cleanHTML: {
|
|
308
|
-
allowTags: {
|
|
309
|
-
p: {
|
|
310
|
-
style: true
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
editor.value =
|
|
316
|
-
'<p style="color: red;" data-id="111">te<strong>stop</strong>st</p><h1>pop</h1>'.repeat(
|
|
317
|
-
500
|
|
318
|
-
);
|
|
319
|
-
expect(editor.value).equals(
|
|
320
|
-
'<p style="color: red;">test</p>'.repeat(500)
|
|
321
|
-
);
|
|
322
|
-
}).timeout(1500);
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
describe('Fullfill empty paragraph', function () {
|
|
327
|
-
it('Should fill in empty paragraph', function () {
|
|
328
|
-
const editor = getJodit({
|
|
329
|
-
cleanHTML: {
|
|
330
|
-
fillEmptyParagraph: true
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
editor.value = '<p></p><p></p><div></div>';
|
|
334
|
-
expect(editor.value).equals(
|
|
335
|
-
'<p><br></p><p><br></p><div><br></div>'
|
|
336
|
-
);
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
describe('Switch off fillEmptyParagraph option', function () {
|
|
340
|
-
it('Should not fill in empty paragraph', function () {
|
|
341
|
-
const editor = getJodit({
|
|
342
|
-
cleanHTML: {
|
|
343
|
-
fillEmptyParagraph: false
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
editor.value = '<p></p><p></p><div></div>';
|
|
347
|
-
expect(editor.value).equals('<p></p><p></p><div></div>');
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
});
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
describe('Color plugin', function () {
|
|
7
|
-
it('Open colorpicker set background and color. After this click in another any place. White when popap will be closed. Open again and remove all styles.', function () {
|
|
8
|
-
const editor = getJodit();
|
|
9
|
-
|
|
10
|
-
editor.value = 'text2text';
|
|
11
|
-
|
|
12
|
-
const range = editor.s.createRange();
|
|
13
|
-
|
|
14
|
-
range.setStart(editor.editor.firstChild.firstChild, 3);
|
|
15
|
-
range.setEnd(editor.editor.firstChild.firstChild, 6);
|
|
16
|
-
|
|
17
|
-
editor.s.selectRange(range);
|
|
18
|
-
|
|
19
|
-
clickButton('brush', editor);
|
|
20
|
-
|
|
21
|
-
const popup = getOpenedPopup(editor);
|
|
22
|
-
|
|
23
|
-
expect(window.getComputedStyle(popup).display).equals('block');
|
|
24
|
-
|
|
25
|
-
simulateEvent(
|
|
26
|
-
'mousedown',
|
|
27
|
-
popup.querySelector('[data-color="#F9CB9C"]')
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
expect(editor.value).equals(
|
|
31
|
-
'<p>tex<span style="background-color: rgb(249, 203, 156);">t2t</span>ext</p>'
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// simulateEvent('mousedown', 0, editor.editor)
|
|
35
|
-
expect(popup.parentNode).is.null;
|
|
36
|
-
|
|
37
|
-
range.selectNodeContents(editor.editor.querySelector('span'));
|
|
38
|
-
// range.collapse(true);
|
|
39
|
-
editor.s.selectRange(range);
|
|
40
|
-
|
|
41
|
-
clickButton('brush', editor);
|
|
42
|
-
|
|
43
|
-
const popup2 = getOpenedPopup(editor);
|
|
44
|
-
expect(popup2).is.null;
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
describe('Show native color picker', function () {
|
|
48
|
-
describe('Enable', function () {
|
|
49
|
-
describe('Select all content by edges', function () {
|
|
50
|
-
it('Should apply style to all elements', function () {
|
|
51
|
-
const editor = getJodit();
|
|
52
|
-
|
|
53
|
-
editor.value = '<p><br></p><p>test</p>';
|
|
54
|
-
const range = editor.s.createRange(true);
|
|
55
|
-
|
|
56
|
-
range.setStart(editor.editor.firstChild, 0);
|
|
57
|
-
range.setEnd(editor.editor.lastChild.firstChild, 4);
|
|
58
|
-
editor.s.selectRange(range);
|
|
59
|
-
|
|
60
|
-
clickButton('brush', editor);
|
|
61
|
-
|
|
62
|
-
const popup = getOpenedPopup(editor);
|
|
63
|
-
|
|
64
|
-
expect(popup).is.not.null;
|
|
65
|
-
|
|
66
|
-
simulateEvent(
|
|
67
|
-
'mousedown',
|
|
68
|
-
popup.querySelector('[data-color="#F9CB9C"]')
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
expect(sortAttributes(editor.value)).equals(
|
|
72
|
-
'<p><span style="background-color:#F9CB9C"><br></span></p>' +
|
|
73
|
-
'<p><span style="background-color:#F9CB9C">test</span></p>'
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should open color picker with button - native color picker', function () {
|
|
79
|
-
const editor = getJodit({
|
|
80
|
-
showBrowserColorPicker: true
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
editor.value = 'text2text';
|
|
84
|
-
|
|
85
|
-
clickTrigger('brush', editor);
|
|
86
|
-
|
|
87
|
-
const list = getOpenedPopup(editor);
|
|
88
|
-
|
|
89
|
-
// In two tabs text-color and background-color
|
|
90
|
-
expect(
|
|
91
|
-
list.querySelectorAll('input[type="color"]').length
|
|
92
|
-
).equals(2);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
describe('Disable', function () {
|
|
97
|
-
it('should open color picker without button - native color picker', function () {
|
|
98
|
-
const editor = getJodit({
|
|
99
|
-
showBrowserColorPicker: false
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
editor.value = 'text2text';
|
|
103
|
-
|
|
104
|
-
clickTrigger('brush', editor);
|
|
105
|
-
|
|
106
|
-
const list = getOpenedPopup(editor);
|
|
107
|
-
|
|
108
|
-
expect(
|
|
109
|
-
list.querySelectorAll('input[type="color"]').length
|
|
110
|
-
).equals(0);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
describe('Buttons', function () {
|
|
116
|
-
describe('In brush popup', function () {
|
|
117
|
-
it('Should be also only text', function () {
|
|
118
|
-
const editor = getJodit({
|
|
119
|
-
textIcons: true
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
clickTrigger('brush', editor);
|
|
123
|
-
|
|
124
|
-
const popup = getOpenedPopup(editor);
|
|
125
|
-
|
|
126
|
-
expect(popup).is.not.null;
|
|
127
|
-
|
|
128
|
-
expect(popup.querySelectorAll('svg, img').length).equals(0);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
describe('State', function () {
|
|
134
|
-
describe('First click on the button', function () {
|
|
135
|
-
it('Should open popup', function () {
|
|
136
|
-
const editor = getJodit();
|
|
137
|
-
|
|
138
|
-
clickButton('brush', editor);
|
|
139
|
-
|
|
140
|
-
const popup = getOpenedPopup(editor);
|
|
141
|
-
|
|
142
|
-
expect(popup).is.not.null;
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
describe('Second click on the button', function () {
|
|
146
|
-
it('Should apply previous choice', function () {
|
|
147
|
-
const editor = getJodit();
|
|
148
|
-
|
|
149
|
-
editor.value = 'text2text';
|
|
150
|
-
|
|
151
|
-
const range = editor.s.createRange(true);
|
|
152
|
-
|
|
153
|
-
range.setStart(editor.editor.firstChild.firstChild, 3);
|
|
154
|
-
range.setEnd(editor.editor.firstChild.firstChild, 6);
|
|
155
|
-
|
|
156
|
-
clickButton('brush', editor);
|
|
157
|
-
|
|
158
|
-
const popup = getOpenedPopup(editor);
|
|
159
|
-
|
|
160
|
-
expect(popup).is.not.null;
|
|
161
|
-
|
|
162
|
-
simulateEvent(
|
|
163
|
-
'mousedown',
|
|
164
|
-
popup.querySelector('[data-color="#F9CB9C"]')
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
expect(editor.value).equals(
|
|
168
|
-
'<p>tex<span style="background-color: rgb(249, 203, 156);">t2t</span>ext</p>'
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
const range2 = editor.s.createRange(true);
|
|
172
|
-
|
|
173
|
-
range2.setStartAfter(editor.editor.firstChild);
|
|
174
|
-
|
|
175
|
-
clickButton('brush', editor);
|
|
176
|
-
|
|
177
|
-
const popup2 = getOpenedPopup(editor);
|
|
178
|
-
|
|
179
|
-
expect(popup2).is.null;
|
|
180
|
-
|
|
181
|
-
expect(editor.value).equals(
|
|
182
|
-
'<p>tex<span style="background-color: rgb(249, 203, 156);">t2t</span>ext</p><p><span style="background-color: rgb(249, 203, 156);"></span></p>'
|
|
183
|
-
);
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
});
|