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,578 +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
|
-
|
|
7
|
-
describe('Text Inline Popup plugin', function () {
|
|
8
|
-
describe('Image', function () {
|
|
9
|
-
describe('Click on the image', function () {
|
|
10
|
-
it('Should Open inline popup', function () {
|
|
11
|
-
const editor = getJodit();
|
|
12
|
-
|
|
13
|
-
editor.value = '<img alt="" src="../artio.jpg"/>';
|
|
14
|
-
editor.s.focus();
|
|
15
|
-
|
|
16
|
-
simulateEvent('click', editor.editor.querySelector('img'));
|
|
17
|
-
|
|
18
|
-
const popup = getOpenedPopup(editor);
|
|
19
|
-
|
|
20
|
-
expect(popup && popup.parentNode.parentNode != null).equals(
|
|
21
|
-
true
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('and click in opened popup on pencil button', function () {
|
|
26
|
-
it('Should Open edit image dialog', function () {
|
|
27
|
-
const editor = getJodit();
|
|
28
|
-
|
|
29
|
-
editor.value = '<img alt="" src="../artio.jpg"/>';
|
|
30
|
-
editor.s.focus();
|
|
31
|
-
|
|
32
|
-
simulateEvent('click', editor.editor.querySelector('img'));
|
|
33
|
-
|
|
34
|
-
const popup = getOpenedPopup(editor);
|
|
35
|
-
|
|
36
|
-
expect(popup && popup.parentNode.parentNode != null).is
|
|
37
|
-
.true;
|
|
38
|
-
|
|
39
|
-
clickButton('pencil', popup);
|
|
40
|
-
|
|
41
|
-
const dialog = editor.ownerDocument.querySelector(
|
|
42
|
-
'.jodit.jodit-dialog[data-editor_id=' + editor.id + ']'
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
expect(dialog).is.not.null;
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe('Link', function () {
|
|
52
|
-
describe('Click on the link', function () {
|
|
53
|
-
it('Should Open inline popup', function () {
|
|
54
|
-
const editor = getJodit();
|
|
55
|
-
|
|
56
|
-
editor.value = '<a href="../artio.jpg"/>test</a>';
|
|
57
|
-
|
|
58
|
-
simulateEvent('click', editor.editor.querySelector('a'));
|
|
59
|
-
|
|
60
|
-
const popup = getOpenedPopup(editor);
|
|
61
|
-
|
|
62
|
-
expect(popup && popup.parentNode.parentNode != null).equals(
|
|
63
|
-
true
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe('and click in opened popup on pencil button', function () {
|
|
68
|
-
it('Should Open edit link dialog', function () {
|
|
69
|
-
const editor = getJodit();
|
|
70
|
-
|
|
71
|
-
editor.value = '<a href="../artio.jpg"/>test</a>';
|
|
72
|
-
simulateEvent('click', editor.editor.querySelector('a'));
|
|
73
|
-
|
|
74
|
-
const popup = getOpenedPopup(editor);
|
|
75
|
-
|
|
76
|
-
expect(popup && popup.parentNode.parentNode != null).is
|
|
77
|
-
.true;
|
|
78
|
-
|
|
79
|
-
clickButton('link', popup);
|
|
80
|
-
|
|
81
|
-
const linkEditor = getOpenedPopup(editor);
|
|
82
|
-
|
|
83
|
-
expect(linkEditor).is.not.null;
|
|
84
|
-
|
|
85
|
-
expect(
|
|
86
|
-
linkEditor.querySelector('[data-ref="url_input"]').value
|
|
87
|
-
).equals('../artio.jpg');
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
describe('on different links', function () {
|
|
91
|
-
it('Should Open edit link dialog with different values', function () {
|
|
92
|
-
const editor = getJodit();
|
|
93
|
-
|
|
94
|
-
editor.value =
|
|
95
|
-
'<a href="#test1"/>test</a><br>' +
|
|
96
|
-
'<a href="#test2"/>test</a>';
|
|
97
|
-
|
|
98
|
-
simulateEvent(
|
|
99
|
-
'click',
|
|
100
|
-
editor.editor.querySelector('a')
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const popup = getOpenedPopup(editor);
|
|
104
|
-
|
|
105
|
-
clickButton('link', popup);
|
|
106
|
-
|
|
107
|
-
const linkEditor = getOpenedPopup(editor);
|
|
108
|
-
|
|
109
|
-
expect(
|
|
110
|
-
linkEditor.querySelector('[data-ref="url_input"]')
|
|
111
|
-
.value
|
|
112
|
-
).equals('#test1');
|
|
113
|
-
|
|
114
|
-
simulateEvent(
|
|
115
|
-
['mousedown', 'mouseup', 'click'],
|
|
116
|
-
editor.editor.querySelectorAll('a')[1]
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
const popup2 = getOpenedPopup(editor);
|
|
120
|
-
|
|
121
|
-
clickButton('link', popup2);
|
|
122
|
-
|
|
123
|
-
const linkEditor2 = getOpenedPopup(editor);
|
|
124
|
-
|
|
125
|
-
expect(
|
|
126
|
-
linkEditor2.querySelector('[data-ref="url_input"]')
|
|
127
|
-
.value
|
|
128
|
-
).equals('#test2');
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe('Table', function () {
|
|
136
|
-
describe('Table button', function () {
|
|
137
|
-
describe('Select table cell', function () {
|
|
138
|
-
it('Should Select table cell', function () {
|
|
139
|
-
const editor = getJodit();
|
|
140
|
-
|
|
141
|
-
editor.value =
|
|
142
|
-
'<table>' + '<tr><td>2</td></tr>' + '</table>';
|
|
143
|
-
|
|
144
|
-
const td = editor.editor.querySelector('td'),
|
|
145
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
146
|
-
|
|
147
|
-
simulateEvent(
|
|
148
|
-
['mousedown', 'mouseup', 'click'],
|
|
149
|
-
0,
|
|
150
|
-
td,
|
|
151
|
-
e => {
|
|
152
|
-
Object.assign(e, {
|
|
153
|
-
clientX: pos.left,
|
|
154
|
-
clientY: pos.top
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
expect([td]).deep.equals(
|
|
160
|
-
editor.getInstance('Table').getAllSelectedCells()
|
|
161
|
-
);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
describe('and press brush button', function () {
|
|
165
|
-
it('Should Select table cell and fill it in yellow', function () {
|
|
166
|
-
const editor = getJodit();
|
|
167
|
-
|
|
168
|
-
editor.value =
|
|
169
|
-
'<table>' + '<tr><td>3</td></tr>' + '</table>';
|
|
170
|
-
|
|
171
|
-
const td = editor.editor.querySelector('td'),
|
|
172
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
173
|
-
|
|
174
|
-
simulateEvent(
|
|
175
|
-
['mousedown', 'mouseup', 'click'],
|
|
176
|
-
0,
|
|
177
|
-
td,
|
|
178
|
-
e => {
|
|
179
|
-
Object.assign(e, {
|
|
180
|
-
clientX: pos.left,
|
|
181
|
-
clientY: pos.top
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
const popup = getOpenedPopup(editor);
|
|
187
|
-
|
|
188
|
-
expect(popup && popup.parentNode.parentNode != null).is
|
|
189
|
-
.true;
|
|
190
|
-
|
|
191
|
-
clickTrigger('brush', popup);
|
|
192
|
-
|
|
193
|
-
const popupColor = getOpenedPopup(editor);
|
|
194
|
-
|
|
195
|
-
expect(
|
|
196
|
-
popupColor &&
|
|
197
|
-
window.getComputedStyle(popupColor).display
|
|
198
|
-
).equals('block');
|
|
199
|
-
|
|
200
|
-
simulateEvent(
|
|
201
|
-
['mousedown', 'mouseup', 'click'],
|
|
202
|
-
popupColor.querySelector('a[data-color="#0000FF"]')
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
expect(
|
|
206
|
-
Jodit.modules.Helpers.normalizeColor(
|
|
207
|
-
td.style.backgroundColor
|
|
208
|
-
)
|
|
209
|
-
).equals('#0000FF');
|
|
210
|
-
|
|
211
|
-
expect(popupColor.parentNode).is.null;
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('Open inline popup after click inside the cell', function () {
|
|
218
|
-
const editor = getJodit();
|
|
219
|
-
|
|
220
|
-
editor.value = '<table><tbody><tr><td>1</td></tr></tbody></table>';
|
|
221
|
-
|
|
222
|
-
const td = editor.editor.querySelector('td'),
|
|
223
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
224
|
-
|
|
225
|
-
simulateEvent('focus', editor.editor);
|
|
226
|
-
simulateEvent(
|
|
227
|
-
['mousedown', 'selectstart', 'mouseup', 'click'],
|
|
228
|
-
td,
|
|
229
|
-
e => {
|
|
230
|
-
Object.assign(e, {
|
|
231
|
-
clientX: pos.left,
|
|
232
|
-
clientY: pos.top
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
const popup = getOpenedPopup(editor);
|
|
238
|
-
expect(popup).is.not.null;
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('Select table cell and change it vertical align', function () {
|
|
242
|
-
const editor = getJodit();
|
|
243
|
-
|
|
244
|
-
editor.value =
|
|
245
|
-
'<table>' +
|
|
246
|
-
'<tr><td style="vertical-align: middle">3</td></tr>' +
|
|
247
|
-
'</table>';
|
|
248
|
-
|
|
249
|
-
const td = editor.editor.querySelector('td'),
|
|
250
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
251
|
-
|
|
252
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], td, e => {
|
|
253
|
-
Object.assign(e, {
|
|
254
|
-
clientX: pos.left,
|
|
255
|
-
clientY: pos.top
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
const popup = getOpenedPopup(editor);
|
|
260
|
-
expect(popup && popup.parentNode.parentNode != null).is.true;
|
|
261
|
-
|
|
262
|
-
clickTrigger('valign', popup);
|
|
263
|
-
|
|
264
|
-
const popupColor = getOpenedPopup(editor);
|
|
265
|
-
expect(popupColor).is.not.null;
|
|
266
|
-
|
|
267
|
-
clickButton('Bottom', popupColor);
|
|
268
|
-
|
|
269
|
-
expect(td.style.verticalAlign).equals('bottom');
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
it('Select table cell and split it by vertical', function () {
|
|
273
|
-
const editor = getJodit();
|
|
274
|
-
|
|
275
|
-
editor.value =
|
|
276
|
-
'<table style="width: 300px;">' +
|
|
277
|
-
'<tr><td>3</td></tr>' +
|
|
278
|
-
'</table>';
|
|
279
|
-
|
|
280
|
-
const td = editor.editor.querySelector('td'),
|
|
281
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
282
|
-
|
|
283
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
|
|
284
|
-
Object.assign(e, {
|
|
285
|
-
clientX: pos.left,
|
|
286
|
-
clientY: pos.top
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
const popup = getOpenedPopup(editor);
|
|
290
|
-
clickTrigger('splitv', popup);
|
|
291
|
-
|
|
292
|
-
const list = getOpenedPopup(editor);
|
|
293
|
-
expect(list).is.not.null;
|
|
294
|
-
clickButton('tablesplitv', list);
|
|
295
|
-
|
|
296
|
-
expect(sortAttributes(editor.value)).equals(
|
|
297
|
-
'<table style="width:300px"><tbody><tr><td style="width:49.83%">3</td><td style="width:49.83%"><br></td></tr></tbody></table>'
|
|
298
|
-
);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it('Select table cell and split it by horizontal', function () {
|
|
302
|
-
const editor = getJodit();
|
|
303
|
-
|
|
304
|
-
editor.value =
|
|
305
|
-
'<table style="width: 300px;">' +
|
|
306
|
-
'<tr><td>5</td></tr>' +
|
|
307
|
-
'</table>';
|
|
308
|
-
|
|
309
|
-
const td = editor.editor.querySelector('td'),
|
|
310
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
311
|
-
|
|
312
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
|
|
313
|
-
Object.assign(e, {
|
|
314
|
-
clientX: pos.left,
|
|
315
|
-
clientY: pos.top
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
const popup = getOpenedPopup(editor);
|
|
320
|
-
|
|
321
|
-
clickTrigger('splitv', popup);
|
|
322
|
-
const list = getOpenedPopup(editor);
|
|
323
|
-
expect(list).is.not.null;
|
|
324
|
-
clickButton('tablesplitg', list);
|
|
325
|
-
|
|
326
|
-
expect(sortAttributes(editor.value)).equals(
|
|
327
|
-
'<table style="width:300px"><tbody><tr><td>5</td></tr><tr><td><br></td></tr></tbody></table>'
|
|
328
|
-
);
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it('Select two table cells and merge then in one', function () {
|
|
332
|
-
const editor = getJodit();
|
|
333
|
-
|
|
334
|
-
editor.value =
|
|
335
|
-
'<table style="width: 300px;">' +
|
|
336
|
-
'<tr><td>5</td><td>6</td></tr>' +
|
|
337
|
-
'</table>';
|
|
338
|
-
|
|
339
|
-
const td = editor.editor.querySelector('td'),
|
|
340
|
-
next = editor.editor.querySelectorAll('td')[1];
|
|
341
|
-
|
|
342
|
-
simulateEvent('mousedown', td);
|
|
343
|
-
|
|
344
|
-
simulateEvent(['mousemove', 'mouseup'], next);
|
|
345
|
-
|
|
346
|
-
const popup = getOpenedPopup(editor);
|
|
347
|
-
|
|
348
|
-
clickButton('merge', popup);
|
|
349
|
-
|
|
350
|
-
expect(sortAttributes(editor.value)).equals(
|
|
351
|
-
'<table style="width:300px"><tbody><tr><td>5<br>6</td></tr></tbody></table>'
|
|
352
|
-
);
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
it('Select table cell add column before this', function () {
|
|
356
|
-
const editor = getJodit();
|
|
357
|
-
|
|
358
|
-
editor.value = '<table>' + '<tr><td>3</td></tr>' + '</table>';
|
|
359
|
-
|
|
360
|
-
const td = editor.editor.querySelector('td'),
|
|
361
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
362
|
-
|
|
363
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
|
|
364
|
-
Object.assign(e, {
|
|
365
|
-
clientX: pos.left,
|
|
366
|
-
clientY: pos.top
|
|
367
|
-
});
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
const popup = getOpenedPopup(editor);
|
|
371
|
-
|
|
372
|
-
expect(popup && popup.parentNode.parentNode != null).is.true;
|
|
373
|
-
|
|
374
|
-
clickTrigger('addcolumn', popup);
|
|
375
|
-
|
|
376
|
-
const popupColor = getOpenedPopup(editor);
|
|
377
|
-
expect(
|
|
378
|
-
popupColor && window.getComputedStyle(popupColor).display
|
|
379
|
-
).equals('block');
|
|
380
|
-
|
|
381
|
-
simulateEvent('click', 0, popupColor.querySelector('button'));
|
|
382
|
-
|
|
383
|
-
expect(sortAttributes(editor.value)).equals(
|
|
384
|
-
'<table><tbody><tr><td></td><td>3</td></tr></tbody></table>'
|
|
385
|
-
);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
it('Select table cell and add row above this', function () {
|
|
389
|
-
const editor = getJodit();
|
|
390
|
-
|
|
391
|
-
editor.value = '<table>' + '<tr><td>3</td></tr>' + '</table>';
|
|
392
|
-
|
|
393
|
-
const td = editor.editor.querySelector('td'),
|
|
394
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
395
|
-
|
|
396
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
|
|
397
|
-
Object.assign(e, {
|
|
398
|
-
clientX: pos.left,
|
|
399
|
-
clientY: pos.top
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
const popup = getOpenedPopup(editor);
|
|
404
|
-
|
|
405
|
-
expect(popup && popup.parentNode.parentNode != null).is.true;
|
|
406
|
-
|
|
407
|
-
clickTrigger('addrow', popup);
|
|
408
|
-
|
|
409
|
-
const popupColor = getOpenedPopup(editor);
|
|
410
|
-
expect(
|
|
411
|
-
popupColor && window.getComputedStyle(popupColor).display
|
|
412
|
-
).equals('block');
|
|
413
|
-
|
|
414
|
-
simulateEvent('click', 0, popupColor.querySelector('button'));
|
|
415
|
-
|
|
416
|
-
expect(sortAttributes(editor.value)).equals(
|
|
417
|
-
'<table><tbody><tr><td></td></tr><tr><td>3</td></tr></tbody></table>'
|
|
418
|
-
);
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
it('Select table cell and remove it row', function () {
|
|
422
|
-
const editor = getJodit();
|
|
423
|
-
|
|
424
|
-
editor.value =
|
|
425
|
-
'<table>' +
|
|
426
|
-
'<tr><td>1</td></tr>' +
|
|
427
|
-
'<tr><td>2</td></tr>' +
|
|
428
|
-
'<tr><td>3</td></tr>' +
|
|
429
|
-
'</table>';
|
|
430
|
-
|
|
431
|
-
const td = editor.editor.querySelectorAll('td')[1],
|
|
432
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
433
|
-
|
|
434
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
|
|
435
|
-
Object.assign(e, {
|
|
436
|
-
clientX: pos.left,
|
|
437
|
-
clientY: pos.top
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
const popup = getOpenedPopup(editor);
|
|
442
|
-
|
|
443
|
-
expect(popup && popup.parentNode.parentNode != null).is.true;
|
|
444
|
-
|
|
445
|
-
clickTrigger('delete', popup);
|
|
446
|
-
|
|
447
|
-
const popupColor = getOpenedPopup(editor);
|
|
448
|
-
expect(
|
|
449
|
-
popupColor && window.getComputedStyle(popupColor).display
|
|
450
|
-
).equals('block');
|
|
451
|
-
|
|
452
|
-
simulateEvent('click', 0, popupColor.querySelectorAll('button')[1]);
|
|
453
|
-
|
|
454
|
-
expect(editor.value).equals(
|
|
455
|
-
'<table><tbody><tr><td>1</td></tr><tr><td>3</td></tr></tbody></table>'
|
|
456
|
-
);
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
it('Select table cell and remove whole table should hide inline popup', function () {
|
|
460
|
-
const editor = getJodit();
|
|
461
|
-
|
|
462
|
-
editor.value =
|
|
463
|
-
'<table>' +
|
|
464
|
-
'<tr><td>1</td></tr>' +
|
|
465
|
-
'<tr><td>2</td></tr>' +
|
|
466
|
-
'<tr><td>3</td></tr>' +
|
|
467
|
-
'</table>';
|
|
468
|
-
|
|
469
|
-
const td = editor.editor.querySelectorAll('td')[1];
|
|
470
|
-
|
|
471
|
-
const pos = Jodit.modules.Helpers.position(td);
|
|
472
|
-
|
|
473
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
|
|
474
|
-
Object.assign(e, {
|
|
475
|
-
clientX: pos.left,
|
|
476
|
-
clientY: pos.top
|
|
477
|
-
});
|
|
478
|
-
});
|
|
479
|
-
|
|
480
|
-
const popup = getOpenedPopup(editor);
|
|
481
|
-
|
|
482
|
-
expect(popup && popup.parentNode.parentNode != null).is.true;
|
|
483
|
-
|
|
484
|
-
clickTrigger('delete', popup);
|
|
485
|
-
|
|
486
|
-
const popupColor = getOpenedPopup(editor);
|
|
487
|
-
expect(
|
|
488
|
-
popupColor && window.getComputedStyle(popupColor).display
|
|
489
|
-
).equals('block');
|
|
490
|
-
|
|
491
|
-
simulateEvent('click', 0, popupColor.querySelector('button'));
|
|
492
|
-
|
|
493
|
-
expect(editor.value).equals('');
|
|
494
|
-
|
|
495
|
-
expect(popup && popup.parentNode).is.null;
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
describe('Link inside cell', function () {
|
|
499
|
-
describe('Click on the link', function () {
|
|
500
|
-
it('Should Open inline popup', function () {
|
|
501
|
-
const editor = getJodit();
|
|
502
|
-
|
|
503
|
-
editor.value =
|
|
504
|
-
'<table style="width: 100%;">' +
|
|
505
|
-
'<tbody>' +
|
|
506
|
-
'<tr>' +
|
|
507
|
-
'<td><a href="http://localhost:8000/">href</a></td>' +
|
|
508
|
-
'<td><br></td>' +
|
|
509
|
-
'</tr>' +
|
|
510
|
-
'</tbody>' +
|
|
511
|
-
'</table>';
|
|
512
|
-
|
|
513
|
-
simulateEvent('click', editor.editor.querySelector('a'));
|
|
514
|
-
|
|
515
|
-
simulateEvent(
|
|
516
|
-
'mousedown',
|
|
517
|
-
editor.editor.querySelector('a')
|
|
518
|
-
);
|
|
519
|
-
simulateEvent('mouseup', editor.editor.querySelector('a'));
|
|
520
|
-
simulateEvent('click', editor.editor.querySelector('a'));
|
|
521
|
-
|
|
522
|
-
const popup = getOpenedPopup(editor);
|
|
523
|
-
|
|
524
|
-
expect(popup && popup.parentNode.parentNode != null).equals(
|
|
525
|
-
true
|
|
526
|
-
);
|
|
527
|
-
|
|
528
|
-
clickButton('link', popup);
|
|
529
|
-
|
|
530
|
-
const linkEditor = getOpenedPopup(editor);
|
|
531
|
-
|
|
532
|
-
expect(linkEditor).is.not.null;
|
|
533
|
-
|
|
534
|
-
const input = linkEditor.querySelector(
|
|
535
|
-
'[data-ref="url_input"]'
|
|
536
|
-
);
|
|
537
|
-
|
|
538
|
-
expect(input.value).equals('http://localhost:8000/');
|
|
539
|
-
|
|
540
|
-
simulateEvent('mousedown', input);
|
|
541
|
-
simulateEvent('mouseup', input);
|
|
542
|
-
simulateEvent('click', input);
|
|
543
|
-
|
|
544
|
-
input.focus();
|
|
545
|
-
|
|
546
|
-
expect(popup && popup.parentNode.parentNode != null).equals(
|
|
547
|
-
true
|
|
548
|
-
);
|
|
549
|
-
|
|
550
|
-
linkEditor.querySelector('[data-ref="url_input"]').value =
|
|
551
|
-
'https://xdsoft.net';
|
|
552
|
-
});
|
|
553
|
-
});
|
|
554
|
-
});
|
|
555
|
-
});
|
|
556
|
-
|
|
557
|
-
describe('when a string is passed to the popup config', function () {
|
|
558
|
-
it('Should show the content of the string in the popup', function () {
|
|
559
|
-
it('Should Open inline popup', function () {
|
|
560
|
-
const editor = getJodit({
|
|
561
|
-
popup: {
|
|
562
|
-
a: '<div class="custom-popup-test">foo</div>'
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
editor.value = '<a href="../artio.jpg"/>test</a>';
|
|
567
|
-
|
|
568
|
-
simulateEvent('click', editor.editor.querySelector('a'));
|
|
569
|
-
|
|
570
|
-
const popup = getOpenedPopup(editor);
|
|
571
|
-
|
|
572
|
-
expect(
|
|
573
|
-
popup.getElementsByClassName('.custom-popup-test').length
|
|
574
|
-
).equals(1);
|
|
575
|
-
});
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
});
|
|
@@ -1,17 +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
|
-
|
|
7
|
-
describe('Test insert plugins', function () {
|
|
8
|
-
describe('hr', function () {
|
|
9
|
-
it('Should insert horizontal line', function () {
|
|
10
|
-
const editor = getJodit();
|
|
11
|
-
editor.execCommand('insertHorizontalRule');
|
|
12
|
-
editor.execCommand('insertHorizontalRule');
|
|
13
|
-
editor.execCommand('insertHorizontalRule');
|
|
14
|
-
expect(editor.value).equals('<hr><hr><hr><p></p>');
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
});
|