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,826 +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 Inline mode', function () {
|
|
8
|
-
describe('init with inline option', function () {
|
|
9
|
-
describe('For TEXTAREA', function () {
|
|
10
|
-
it('Should hide textarea like standart mode', function () {
|
|
11
|
-
const area = appendTestArea(),
|
|
12
|
-
editor = new Jodit(area, {
|
|
13
|
-
inline: true
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
expect(editor.container).does.not.equal(area);
|
|
17
|
-
expect(editor.container.classList.contains('jodit_inline')).is
|
|
18
|
-
.true;
|
|
19
|
-
expect(editor.container.nextSibling).equals(area);
|
|
20
|
-
expect(area.style.display).equals('none');
|
|
21
|
-
expect(area.value).equals(editor.value);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('For DIV', function () {
|
|
26
|
-
it('Should use this element like container', function () {
|
|
27
|
-
const div = appendTestDiv(),
|
|
28
|
-
value = '<p>HTML</p>';
|
|
29
|
-
|
|
30
|
-
div.innerHTML = value;
|
|
31
|
-
|
|
32
|
-
const editor = new Jodit(div, {
|
|
33
|
-
inline: true,
|
|
34
|
-
observer: {
|
|
35
|
-
timeout: 0
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
expect(editor.container).equals(div);
|
|
40
|
-
expect(editor.container.classList.contains('jodit_inline')).is
|
|
41
|
-
.true;
|
|
42
|
-
expect(editor.container.querySelector('.jodit-workplace')).is
|
|
43
|
-
.not.null;
|
|
44
|
-
expect(editor.container.querySelector('.jodit-wysiwyg')).is.not
|
|
45
|
-
.null;
|
|
46
|
-
expect(editor.ownerWindow.getComputedStyle(div).display).equals(
|
|
47
|
-
'block'
|
|
48
|
-
);
|
|
49
|
-
expect(value).equals(editor.value);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe('For H1', function () {
|
|
54
|
-
it('Should use this element like container', function () {
|
|
55
|
-
const div = document.createElement('h1'),
|
|
56
|
-
value = 'HTML';
|
|
57
|
-
|
|
58
|
-
div.innerHTML = value;
|
|
59
|
-
|
|
60
|
-
getBox().appendChild(div);
|
|
61
|
-
|
|
62
|
-
const editor = new Jodit(div, {
|
|
63
|
-
disablePlugins: ['WrapTextNodes'],
|
|
64
|
-
inline: true,
|
|
65
|
-
observer: {
|
|
66
|
-
timeout: 0
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
expect(editor.container).equals(div);
|
|
71
|
-
expect(editor.container.classList.contains('jodit_inline')).is
|
|
72
|
-
.true;
|
|
73
|
-
expect(editor.container.querySelector('.jodit-workplace')).is
|
|
74
|
-
.not.null;
|
|
75
|
-
expect(editor.container.querySelector('.jodit-wysiwyg')).is.not
|
|
76
|
-
.null;
|
|
77
|
-
expect(editor.ownerWindow.getComputedStyle(div).display).equals(
|
|
78
|
-
'block'
|
|
79
|
-
);
|
|
80
|
-
expect(value).equals(editor.value);
|
|
81
|
-
|
|
82
|
-
div.parentNode.removeChild(div);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('Destruct Jodit', function () {
|
|
88
|
-
describe('For TEXTAREA', function () {
|
|
89
|
-
it('Should show textarea like standart mode', function () {
|
|
90
|
-
const area = appendTestArea(),
|
|
91
|
-
editor = new Jodit(area, {
|
|
92
|
-
inline: true
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
editor.destruct();
|
|
96
|
-
expect(area.style.display).does.not.equal('none');
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
describe('For DIV', function () {
|
|
100
|
-
it('Should remove all extra classes and remove all extra elements', function () {
|
|
101
|
-
const div = appendTestDiv(),
|
|
102
|
-
value = '<p>HTML</p>';
|
|
103
|
-
|
|
104
|
-
div.style.display = 'block';
|
|
105
|
-
div.innerHTML = value;
|
|
106
|
-
|
|
107
|
-
const editor = new Jodit(div, {
|
|
108
|
-
inline: true,
|
|
109
|
-
observer: {
|
|
110
|
-
timeout: 0
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
editor.destruct();
|
|
115
|
-
|
|
116
|
-
expect(editor.ownerWindow.getComputedStyle(div).display).equals(
|
|
117
|
-
'block'
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
expect(div.innerHTML).equals(value);
|
|
121
|
-
expect(div.className.toString()).equals('');
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
describe('Inline popups', function () {
|
|
127
|
-
describe('Click on Image', function () {
|
|
128
|
-
it('Should show inline popup', function () {
|
|
129
|
-
const editor = getJodit();
|
|
130
|
-
|
|
131
|
-
editor.value = '<p>test <img/> test</p>';
|
|
132
|
-
const img = editor.editor.querySelector('img');
|
|
133
|
-
simulateEvent('click', 0, img);
|
|
134
|
-
|
|
135
|
-
const popup = getOpenedPopup(editor);
|
|
136
|
-
expect(popup).is.not.null;
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
describe('Disable toolbarInline = false', function () {
|
|
140
|
-
it('Should show inline popup', function () {
|
|
141
|
-
const editor = getJodit({
|
|
142
|
-
toolbarInline: false
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
editor.value = '<p>test <img/> test</p>';
|
|
146
|
-
const img = editor.editor.querySelector('img');
|
|
147
|
-
simulateEvent('click', 0, img);
|
|
148
|
-
const popup = getOpenedPopup(editor);
|
|
149
|
-
|
|
150
|
-
expect(popup).is.null;
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
describe('Click in the right side of editor', function () {
|
|
155
|
-
it('Should open inline-popup with float by right editor side', function () {
|
|
156
|
-
getBox().style.width = 'auto';
|
|
157
|
-
|
|
158
|
-
const editor = getJodit({
|
|
159
|
-
disablePlugins: 'mobile'
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
editor.value =
|
|
163
|
-
'<p>test <img style="width: 30px; float: right"/> test</p>';
|
|
164
|
-
editor.s.focus();
|
|
165
|
-
|
|
166
|
-
simulateEvent(
|
|
167
|
-
'click',
|
|
168
|
-
0,
|
|
169
|
-
editor.editor.querySelector('img')
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
const popup = getOpenedPopup(editor);
|
|
173
|
-
|
|
174
|
-
expect(popup).not.null;
|
|
175
|
-
|
|
176
|
-
const positionPopup = offset(popup);
|
|
177
|
-
const positionContainer = offset(editor.container);
|
|
178
|
-
|
|
179
|
-
expect(
|
|
180
|
-
Math.abs(
|
|
181
|
-
positionPopup.left +
|
|
182
|
-
positionPopup.width -
|
|
183
|
-
(positionContainer.left +
|
|
184
|
-
positionContainer.width)
|
|
185
|
-
) < 20
|
|
186
|
-
).is.true;
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
describe('Click in the right side of editor in window with scroll', function () {
|
|
190
|
-
it('Should open inline-popup with float by right editor side', function () {
|
|
191
|
-
getBox().style.width = 'auto';
|
|
192
|
-
const brs = [];
|
|
193
|
-
|
|
194
|
-
for (let i = 0; i < 100; i += 1) {
|
|
195
|
-
const br = document.createElement('br');
|
|
196
|
-
document.body.appendChild(br);
|
|
197
|
-
brs.push(br);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const editor = getJodit({
|
|
201
|
-
disablePlugins: 'mobile'
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
editor.value =
|
|
205
|
-
'<p>test <img style="width: 30px; float: right"/> test</p>';
|
|
206
|
-
editor.s.focus();
|
|
207
|
-
|
|
208
|
-
simulateEvent(
|
|
209
|
-
'click',
|
|
210
|
-
0,
|
|
211
|
-
editor.editor.querySelector('img')
|
|
212
|
-
);
|
|
213
|
-
|
|
214
|
-
const popup = getOpenedPopup(editor);
|
|
215
|
-
|
|
216
|
-
expect(popup).to.not.null;
|
|
217
|
-
|
|
218
|
-
const positionPopup = offset(popup);
|
|
219
|
-
const positionContainer = offset(editor.container);
|
|
220
|
-
|
|
221
|
-
expect(
|
|
222
|
-
Math.abs(
|
|
223
|
-
positionPopup.left +
|
|
224
|
-
positionPopup.width -
|
|
225
|
-
(positionContainer.left +
|
|
226
|
-
positionContainer.width)
|
|
227
|
-
) < 20
|
|
228
|
-
).to.true;
|
|
229
|
-
|
|
230
|
-
brs.forEach(function (br) {
|
|
231
|
-
br.parentNode && br.parentNode.removeChild(br);
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
describe('Recalculate position after Scroll', function () {
|
|
238
|
-
it('Should reacalc inline popup position', function () {
|
|
239
|
-
const editor = getJodit({
|
|
240
|
-
height: 500
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
editor.value =
|
|
244
|
-
'<p>test' +
|
|
245
|
-
'<br>'.repeat(20) +
|
|
246
|
-
' <img style="width:100px;height:100px;" src="tests/artio.jpg"/> ' +
|
|
247
|
-
'<br>'.repeat(20) +
|
|
248
|
-
'test</p>';
|
|
249
|
-
|
|
250
|
-
const img = editor.editor.querySelector('img');
|
|
251
|
-
img.scrollIntoView();
|
|
252
|
-
|
|
253
|
-
simulateEvent('click', 0, img);
|
|
254
|
-
const popup = getOpenedPopup(editor);
|
|
255
|
-
expect(popup).is.not.null;
|
|
256
|
-
|
|
257
|
-
let imgPosition = offset(img);
|
|
258
|
-
let popupPosition = offset(popup);
|
|
259
|
-
|
|
260
|
-
expect(
|
|
261
|
-
Math.abs(
|
|
262
|
-
popupPosition.top -
|
|
263
|
-
(imgPosition.top + imgPosition.height) -
|
|
264
|
-
10
|
|
265
|
-
) < 20
|
|
266
|
-
).is.true;
|
|
267
|
-
|
|
268
|
-
editor.editor.scrollTop = editor.editor.scrollTop + 50;
|
|
269
|
-
simulateEvent('scroll', 0, editor.editor);
|
|
270
|
-
|
|
271
|
-
imgPosition = offset(img);
|
|
272
|
-
popupPosition = offset(popup);
|
|
273
|
-
|
|
274
|
-
expect(
|
|
275
|
-
Math.abs(
|
|
276
|
-
popupPosition.top -
|
|
277
|
-
(imgPosition.top + imgPosition.height) -
|
|
278
|
-
10
|
|
279
|
-
) < 20
|
|
280
|
-
).is.true;
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
describe('Popup position outside of editor', function () {
|
|
285
|
-
it('Should hide inline popup', function () {
|
|
286
|
-
const editor = getJodit({
|
|
287
|
-
height: 500
|
|
288
|
-
});
|
|
289
|
-
editor.value =
|
|
290
|
-
'<p>test' +
|
|
291
|
-
'<br>'.repeat(20) +
|
|
292
|
-
' <img style="width:100px;height:100px;" src="tests/artio.jpg"/> ' +
|
|
293
|
-
'<br>'.repeat(120) +
|
|
294
|
-
'test</p>';
|
|
295
|
-
|
|
296
|
-
const img = editor.editor.querySelector('img');
|
|
297
|
-
img.scrollIntoView();
|
|
298
|
-
simulateEvent('click', 0, img);
|
|
299
|
-
const popup = getOpenedPopup(editor);
|
|
300
|
-
expect(popup).is.not.null;
|
|
301
|
-
|
|
302
|
-
const imgPosition = offset(img);
|
|
303
|
-
const popupPosition = offset(popup);
|
|
304
|
-
|
|
305
|
-
expect(
|
|
306
|
-
Math.abs(
|
|
307
|
-
popupPosition.top -
|
|
308
|
-
(imgPosition.top + imgPosition.height) -
|
|
309
|
-
10
|
|
310
|
-
) < 20
|
|
311
|
-
).is.true;
|
|
312
|
-
|
|
313
|
-
editor.editor.scrollTop += 1000;
|
|
314
|
-
simulateEvent('scroll', 0, editor.editor);
|
|
315
|
-
|
|
316
|
-
expect(popup.parentNode).is.not.null;
|
|
317
|
-
|
|
318
|
-
img.scrollIntoView();
|
|
319
|
-
simulateEvent('scroll', 0, editor.editor);
|
|
320
|
-
|
|
321
|
-
expect(popup.parentNode).is.not.null;
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
describe('Click on link', function () {
|
|
327
|
-
it('Should show inline popup', function () {
|
|
328
|
-
const editor = new Jodit(appendTestDiv());
|
|
329
|
-
editor.value = '<p>test <a href="#test">test</a> test</p>';
|
|
330
|
-
const a = editor.editor.querySelector('a');
|
|
331
|
-
simulateEvent('click', 0, a);
|
|
332
|
-
const popup = getOpenedPopup(editor);
|
|
333
|
-
expect(popup).is.not.null;
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
describe('Disable with toolbarInlineDisableFor', function () {
|
|
337
|
-
describe('Option like string', function () {
|
|
338
|
-
it('Should now show inline popup for link', function () {
|
|
339
|
-
const editor = new Jodit(appendTestDiv(), {
|
|
340
|
-
toolbarInline: true,
|
|
341
|
-
toolbarInlineDisableFor: 'a,IMG'
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
editor.value =
|
|
345
|
-
'<table><tr><td>1</td></tr></table><p>test <a href="#test">test</a> <img style="width:30px" src="tests/artio.jpg">> test</p>';
|
|
346
|
-
const a = editor.editor.querySelector('a');
|
|
347
|
-
const img = editor.editor.querySelector('img');
|
|
348
|
-
const td = editor.editor.querySelector('td');
|
|
349
|
-
simulateEvent('click', a);
|
|
350
|
-
|
|
351
|
-
let popup = getOpenedPopup(editor);
|
|
352
|
-
expect(popup).is.null;
|
|
353
|
-
|
|
354
|
-
simulateEvent('click', img);
|
|
355
|
-
popup = getOpenedPopup(editor);
|
|
356
|
-
|
|
357
|
-
expect(popup).is.null;
|
|
358
|
-
|
|
359
|
-
simulateEvent('click', td);
|
|
360
|
-
popup = getOpenedPopup(editor);
|
|
361
|
-
|
|
362
|
-
expect(popup).is.null;
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
describe('Option like array', function () {
|
|
367
|
-
it('Should now show inline popup for link', function () {
|
|
368
|
-
const editor = new Jodit(appendTestDiv(), {
|
|
369
|
-
toolbarInline: true,
|
|
370
|
-
toolbarInlineDisableFor: ['A', 'cells']
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
editor.value =
|
|
374
|
-
'<table><tr><td>1</td></tr></table><p>test <a href="#test">test</a> <img style="width:30px;height:30px;" src="tests/artio.jpg">> test</p>';
|
|
375
|
-
|
|
376
|
-
const a = editor.editor.querySelector('a');
|
|
377
|
-
const img = editor.editor.querySelector('img');
|
|
378
|
-
const td = editor.editor.querySelector('td');
|
|
379
|
-
|
|
380
|
-
simulateEvent('click', a);
|
|
381
|
-
|
|
382
|
-
let popup = getOpenedPopup(editor);
|
|
383
|
-
expect(popup).is.null;
|
|
384
|
-
|
|
385
|
-
simulateEvent('click', img);
|
|
386
|
-
popup = getOpenedPopup(editor);
|
|
387
|
-
|
|
388
|
-
expect(popup).is.not.null;
|
|
389
|
-
|
|
390
|
-
simulateEvent('click', editor.editor);
|
|
391
|
-
|
|
392
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], td);
|
|
393
|
-
|
|
394
|
-
popup = getOpenedPopup(editor);
|
|
395
|
-
|
|
396
|
-
expect(popup).is.null;
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
describe('Click on table cell', function () {
|
|
403
|
-
it('Should show inline popup', function () {
|
|
404
|
-
const editor = getJodit();
|
|
405
|
-
editor.value =
|
|
406
|
-
'<table><tr><td>test test</a> test</td></tr></table>';
|
|
407
|
-
|
|
408
|
-
const td = editor.editor.querySelector('td');
|
|
409
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td);
|
|
410
|
-
|
|
411
|
-
const popup = getOpenedPopup(editor);
|
|
412
|
-
expect(popup).is.not.null;
|
|
413
|
-
});
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
describe('Selection some text inside the editor', function () {
|
|
417
|
-
it('Should show inline popup', function () {
|
|
418
|
-
const editor = new Jodit(appendTestDiv(), {
|
|
419
|
-
preset: 'inline'
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
editor.value = 'test<br>test';
|
|
423
|
-
|
|
424
|
-
simulateEvent('mousedown', editor.ed);
|
|
425
|
-
editor.s.select(editor.editor.firstChild);
|
|
426
|
-
simulateEvent('mouseup', editor.ed);
|
|
427
|
-
|
|
428
|
-
const popup = getOpenedPopup(editor);
|
|
429
|
-
expect(popup).is.not.null;
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
describe('In readonly mode', function () {
|
|
433
|
-
it('Should not show inline popup', function () {
|
|
434
|
-
const editor = new Jodit(appendTestDiv(), {
|
|
435
|
-
preset: 'inline',
|
|
436
|
-
readonly: true
|
|
437
|
-
});
|
|
438
|
-
editor.value = 'test<br>test';
|
|
439
|
-
simulateEvent('mousedown', editor.ed);
|
|
440
|
-
editor.s.select(editor.editor.firstChild);
|
|
441
|
-
simulateEvent('mouseup', editor.ed);
|
|
442
|
-
const popup = getOpenedPopup(editor);
|
|
443
|
-
expect(popup).is.null;
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
describe('After disable readonly mode', function () {
|
|
447
|
-
it('Should show inline popup', function () {
|
|
448
|
-
const editor = new Jodit(appendTestDiv(), {
|
|
449
|
-
preset: 'inline',
|
|
450
|
-
readonly: true
|
|
451
|
-
});
|
|
452
|
-
editor.value = 'test<br>test';
|
|
453
|
-
simulateEvent('mousedown', editor.ed);
|
|
454
|
-
editor.s.select(editor.editor.firstChild);
|
|
455
|
-
simulateEvent('mouseup', editor.ed);
|
|
456
|
-
|
|
457
|
-
let popup = getOpenedPopup(editor);
|
|
458
|
-
expect(popup).is.null;
|
|
459
|
-
|
|
460
|
-
editor.setReadOnly(false);
|
|
461
|
-
|
|
462
|
-
simulateEvent('mousedown', editor.ed);
|
|
463
|
-
editor.s.select(editor.editor.firstChild);
|
|
464
|
-
simulateEvent('mouseup', editor.ed);
|
|
465
|
-
popup = getOpenedPopup(editor);
|
|
466
|
-
expect(popup).is.not.null;
|
|
467
|
-
|
|
468
|
-
expect(
|
|
469
|
-
editor.ownerWindow.getComputedStyle(popup).display
|
|
470
|
-
).equals('block');
|
|
471
|
-
});
|
|
472
|
-
});
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
describe('After then selection was collapsed', function () {
|
|
476
|
-
it('Should hide inline popup', function () {
|
|
477
|
-
const editor = new Jodit(appendTestDiv(), {
|
|
478
|
-
preset: 'inline'
|
|
479
|
-
});
|
|
480
|
-
editor.value = 'test<br>test';
|
|
481
|
-
|
|
482
|
-
simulateEvent('mousedown', editor.ed);
|
|
483
|
-
editor.s.select(editor.editor.firstChild);
|
|
484
|
-
simulateEvent('mouseup', editor.ed);
|
|
485
|
-
|
|
486
|
-
const popup = getOpenedPopup(editor);
|
|
487
|
-
expect(popup).is.not.null;
|
|
488
|
-
const range = editor.s.createRange();
|
|
489
|
-
range.setStart(editor.editor.firstChild, 0);
|
|
490
|
-
range.collapse(true);
|
|
491
|
-
editor.s.selectRange(range);
|
|
492
|
-
simulateEvent('click', editor.editor);
|
|
493
|
-
expect(popup.parentNode).is.null;
|
|
494
|
-
});
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
describe('Select some text in one editor and after this select focus in another', function () {
|
|
498
|
-
it('Should hide inline popup in first', function () {
|
|
499
|
-
const editor = new Jodit(appendTestDiv(), {
|
|
500
|
-
preset: 'inline',
|
|
501
|
-
observer: {
|
|
502
|
-
timeout: 0
|
|
503
|
-
}
|
|
504
|
-
}),
|
|
505
|
-
editor2 = new Jodit(appendTestDiv(), {
|
|
506
|
-
preset: 'inline',
|
|
507
|
-
observer: {
|
|
508
|
-
timeout: 0
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
expect(editor.async).does.not.equal(editor2.async);
|
|
513
|
-
|
|
514
|
-
editor.value = 'test<br>test';
|
|
515
|
-
editor2.value = 'test<br>test';
|
|
516
|
-
|
|
517
|
-
simulateEvent('mousedown', editor.ed);
|
|
518
|
-
editor.s.select(editor.editor.firstChild);
|
|
519
|
-
simulateEvent('mouseup', editor.ed);
|
|
520
|
-
|
|
521
|
-
const popup = getOpenedPopup(editor);
|
|
522
|
-
expect(popup).is.not.null;
|
|
523
|
-
expect(popup.parentNode).is.not.null;
|
|
524
|
-
|
|
525
|
-
const range = editor2.ed.createRange();
|
|
526
|
-
range.setStart(editor2.editor.firstChild, 0);
|
|
527
|
-
range.collapse(true);
|
|
528
|
-
editor2.s.selectRange(range);
|
|
529
|
-
simulateEvent('click', editor2.ownerWindow);
|
|
530
|
-
|
|
531
|
-
expect(popup.parentNode).is.null;
|
|
532
|
-
});
|
|
533
|
-
});
|
|
534
|
-
|
|
535
|
-
describe('Click on `link` button in this popup', function () {
|
|
536
|
-
it('Should show second popup', function (done) {
|
|
537
|
-
const editor = getJodit(
|
|
538
|
-
{
|
|
539
|
-
preset: 'inline'
|
|
540
|
-
},
|
|
541
|
-
appendTestDiv()
|
|
542
|
-
);
|
|
543
|
-
|
|
544
|
-
editor.value = '<p>|test <img/> test|</p>';
|
|
545
|
-
setCursorToChar(editor);
|
|
546
|
-
|
|
547
|
-
simulateEvent('mousedown', editor.ed);
|
|
548
|
-
editor.s.select(editor.editor.firstChild);
|
|
549
|
-
simulateEvent('mouseup', editor.ed);
|
|
550
|
-
|
|
551
|
-
const popup = getOpenedPopup(editor);
|
|
552
|
-
expect(popup).is.not.null;
|
|
553
|
-
|
|
554
|
-
clickButton('link', popup);
|
|
555
|
-
const linkPopup = getOpenedPopup(editor);
|
|
556
|
-
expect(linkPopup).is.not.null;
|
|
557
|
-
expect(linkPopup).does.not.eq(popup);
|
|
558
|
-
|
|
559
|
-
const input = linkPopup.querySelector(
|
|
560
|
-
'[data-ref="url_input"]'
|
|
561
|
-
),
|
|
562
|
-
button = linkPopup.querySelector('[data-ref="insert"]');
|
|
563
|
-
|
|
564
|
-
simulateEvent(
|
|
565
|
-
['mousedown', 'mouseup', 'click', 'focus'],
|
|
566
|
-
input
|
|
567
|
-
);
|
|
568
|
-
|
|
569
|
-
input.focus();
|
|
570
|
-
|
|
571
|
-
simulateEvent('selectionchange', editor.editor);
|
|
572
|
-
|
|
573
|
-
simulateEvent('mouseup', input);
|
|
574
|
-
|
|
575
|
-
setTimeout(function () {
|
|
576
|
-
expect(getOpenedPopup(editor)).eq(linkPopup);
|
|
577
|
-
|
|
578
|
-
input.value = 'https://xdsoft.net/jodit/';
|
|
579
|
-
|
|
580
|
-
button.click();
|
|
581
|
-
expect(getOpenedPopup(editor)).eq(popup);
|
|
582
|
-
|
|
583
|
-
expect(sortAttributes(editor.value)).eq(
|
|
584
|
-
'<p><a href="https://xdsoft.net/jodit/">test <img> test</a></p>'
|
|
585
|
-
);
|
|
586
|
-
|
|
587
|
-
done();
|
|
588
|
-
}, 1000);
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
|
-
});
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
describe('In iframe mode', function () {
|
|
595
|
-
describe('Inline popups', function () {
|
|
596
|
-
describe('Click on Image', function () {
|
|
597
|
-
it('Should show inline popup', function (done) {
|
|
598
|
-
unmockPromise();
|
|
599
|
-
|
|
600
|
-
Jodit.make(appendTestDiv(), {
|
|
601
|
-
iframe: true,
|
|
602
|
-
events: {
|
|
603
|
-
afterConstructor: function (editor) {
|
|
604
|
-
editor.value = '<p>test <img/> test</p>';
|
|
605
|
-
const img = editor.editor.querySelector('img');
|
|
606
|
-
|
|
607
|
-
simulateEvent('click', 0, img);
|
|
608
|
-
const popup = getOpenedPopup(editor);
|
|
609
|
-
expect(popup).is.not.null;
|
|
610
|
-
done();
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
describe('Disable toolbarInline = false', function () {
|
|
617
|
-
it('Should show inline popup', function (done) {
|
|
618
|
-
unmockPromise();
|
|
619
|
-
Jodit.make(appendTestDiv(), {
|
|
620
|
-
toolbarInline: false,
|
|
621
|
-
iframe: true,
|
|
622
|
-
events: {
|
|
623
|
-
afterConstructor: function (editor) {
|
|
624
|
-
editor.value = '<p>test <img/> test</p>';
|
|
625
|
-
const img =
|
|
626
|
-
editor.editor.querySelector('img');
|
|
627
|
-
simulateEvent('click', 0, img);
|
|
628
|
-
const popup = getOpenedPopup(editor);
|
|
629
|
-
expect(popup).is.null;
|
|
630
|
-
done();
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
});
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
describe('Click on Image', function () {
|
|
639
|
-
describe('On mobile', function () {
|
|
640
|
-
it('Should show inline popup', function (done) {
|
|
641
|
-
unmockPromise();
|
|
642
|
-
Jodit.make(appendTestDiv(), {
|
|
643
|
-
iframe: true,
|
|
644
|
-
events: {
|
|
645
|
-
afterConstructor: function (editor) {
|
|
646
|
-
editor.value = '<p>test <img/> test</p>';
|
|
647
|
-
const img =
|
|
648
|
-
editor.editor.querySelector('img');
|
|
649
|
-
simulateEvent('click', 0, img);
|
|
650
|
-
const popup = getOpenedPopup(editor);
|
|
651
|
-
expect(popup).is.not.null;
|
|
652
|
-
done();
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
});
|
|
657
|
-
});
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
describe('Click on link', function () {
|
|
661
|
-
it('Should show inline popup', function (done) {
|
|
662
|
-
unmockPromise();
|
|
663
|
-
Jodit.make(appendTestDiv(), {
|
|
664
|
-
iframe: true,
|
|
665
|
-
events: {
|
|
666
|
-
afterConstructor: function (editor) {
|
|
667
|
-
editor.value =
|
|
668
|
-
'<p>test <a href="#test">test</a> test</p>';
|
|
669
|
-
const a = editor.editor.querySelector('a');
|
|
670
|
-
simulateEvent('click', 0, a);
|
|
671
|
-
const popup = getOpenedPopup(editor);
|
|
672
|
-
expect(popup).is.not.null;
|
|
673
|
-
done();
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
});
|
|
678
|
-
|
|
679
|
-
describe('Disable with toolbarInlineDisableFor', function () {
|
|
680
|
-
describe('Option like string', function () {
|
|
681
|
-
it('Should not show inline popup for link', function (done) {
|
|
682
|
-
unmockPromise();
|
|
683
|
-
Jodit.make(appendTestDiv(), {
|
|
684
|
-
iframe: true,
|
|
685
|
-
toolbarInline: true,
|
|
686
|
-
toolbarInlineDisableFor: 'a,IMG',
|
|
687
|
-
events: {
|
|
688
|
-
afterConstructor: function (editor) {
|
|
689
|
-
editor.value =
|
|
690
|
-
'<table><tr><td>1</td></tr></table><p>test <a href="#test">test</a> <img style="width:30px" src="tests/artio.jpg">> test</p>';
|
|
691
|
-
|
|
692
|
-
const a =
|
|
693
|
-
editor.editor.querySelector('a');
|
|
694
|
-
const img =
|
|
695
|
-
editor.editor.querySelector('img');
|
|
696
|
-
const td =
|
|
697
|
-
editor.editor.querySelector('td');
|
|
698
|
-
|
|
699
|
-
simulateEvent('click', 0, a);
|
|
700
|
-
|
|
701
|
-
let popup = getOpenedPopup(editor);
|
|
702
|
-
expect(popup).is.null;
|
|
703
|
-
|
|
704
|
-
simulateEvent('click', 0, img);
|
|
705
|
-
popup = getOpenedPopup(editor);
|
|
706
|
-
|
|
707
|
-
expect(popup).is.null;
|
|
708
|
-
|
|
709
|
-
simulateEvent('click', editor.editor); // hide previous popup
|
|
710
|
-
simulateEvent(
|
|
711
|
-
['mousedown', 'mouseup', 'click'],
|
|
712
|
-
td
|
|
713
|
-
);
|
|
714
|
-
popup = getOpenedPopup(editor);
|
|
715
|
-
|
|
716
|
-
expect(popup).is.not.null;
|
|
717
|
-
done();
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
});
|
|
721
|
-
});
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
describe('Option like array', function () {
|
|
725
|
-
it('Should not show inline popup for link', function (done) {
|
|
726
|
-
unmockPromise();
|
|
727
|
-
Jodit.make(appendTestDiv(), {
|
|
728
|
-
iframe: true,
|
|
729
|
-
toolbarInline: true,
|
|
730
|
-
toolbarInlineDisableFor: ['A', 'cells'],
|
|
731
|
-
events: {
|
|
732
|
-
afterConstructor: function (editor) {
|
|
733
|
-
editor.value =
|
|
734
|
-
'<table><tr><td>1</td></tr></table><p>test <a href="#test">test</a> <img style="width:30px" src="tests/artio.jpg">> test</p>';
|
|
735
|
-
const a =
|
|
736
|
-
editor.editor.querySelector('a');
|
|
737
|
-
const img =
|
|
738
|
-
editor.editor.querySelector('img');
|
|
739
|
-
const td =
|
|
740
|
-
editor.editor.querySelector('td');
|
|
741
|
-
simulateEvent('click', a);
|
|
742
|
-
|
|
743
|
-
let popup = getOpenedPopup(editor);
|
|
744
|
-
expect(popup).is.null;
|
|
745
|
-
|
|
746
|
-
simulateEvent('click', img);
|
|
747
|
-
popup = getOpenedPopup(editor);
|
|
748
|
-
|
|
749
|
-
expect(popup).is.not.null;
|
|
750
|
-
|
|
751
|
-
simulateEvent('click', editor.editor); // hide previous popup
|
|
752
|
-
|
|
753
|
-
simulateEvent(
|
|
754
|
-
['mousedown', 'mouseup', 'click'],
|
|
755
|
-
td
|
|
756
|
-
);
|
|
757
|
-
popup = getOpenedPopup(editor);
|
|
758
|
-
|
|
759
|
-
expect(popup).is.null;
|
|
760
|
-
|
|
761
|
-
done();
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
});
|
|
766
|
-
});
|
|
767
|
-
});
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
describe('Click on table cell', function () {
|
|
771
|
-
it('Should show inline popup', function (done) {
|
|
772
|
-
unmockPromise();
|
|
773
|
-
Jodit.make(appendTestDiv(), {
|
|
774
|
-
iframe: true,
|
|
775
|
-
events: {
|
|
776
|
-
afterConstructor: function (editor) {
|
|
777
|
-
editor.value =
|
|
778
|
-
'<table><tr><td>test test</a> test</td></tr></table>';
|
|
779
|
-
|
|
780
|
-
const td = editor.editor.querySelector('td'),
|
|
781
|
-
pos = Jodit.modules.Helpers.position(td);
|
|
782
|
-
|
|
783
|
-
simulateEvent(
|
|
784
|
-
['mousedown', 'mouseup', 'click'],
|
|
785
|
-
td,
|
|
786
|
-
function (o) {
|
|
787
|
-
o.clientX = pos.left + 5;
|
|
788
|
-
o.clientY = pos.top + 5;
|
|
789
|
-
}
|
|
790
|
-
);
|
|
791
|
-
|
|
792
|
-
const popup = getOpenedPopup(editor);
|
|
793
|
-
expect(popup).is.not.null;
|
|
794
|
-
|
|
795
|
-
done();
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
});
|
|
800
|
-
});
|
|
801
|
-
|
|
802
|
-
describe('Selection some text inside the editor', function () {
|
|
803
|
-
it('Should show inline popup', function (done) {
|
|
804
|
-
unmockPromise();
|
|
805
|
-
Jodit.make(appendTestDiv(), {
|
|
806
|
-
preset: 'inline',
|
|
807
|
-
iframe: true,
|
|
808
|
-
events: {
|
|
809
|
-
afterConstructor: function (editor) {
|
|
810
|
-
editor.value = 'test<br>test';
|
|
811
|
-
|
|
812
|
-
simulateEvent('mousedown', editor.ed);
|
|
813
|
-
editor.s.select(editor.editor.firstChild);
|
|
814
|
-
simulateEvent('mouseup', editor.ed);
|
|
815
|
-
|
|
816
|
-
const popup = getOpenedPopup(editor);
|
|
817
|
-
expect(popup).is.not.null;
|
|
818
|
-
done();
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
});
|
|
822
|
-
});
|
|
823
|
-
});
|
|
824
|
-
});
|
|
825
|
-
});
|
|
826
|
-
});
|