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,329 +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('Resize plugin', function () {
|
|
8
|
-
describe('Resize box', function () {
|
|
9
|
-
describe('In relative object', function () {
|
|
10
|
-
it('should be in front of image', function () {
|
|
11
|
-
const div = document.createElement('div');
|
|
12
|
-
div.innerHTML =
|
|
13
|
-
'<div style="width:800px; margin:auto; border:1px solid red;">\n' +
|
|
14
|
-
' wrong image selection\n' +
|
|
15
|
-
' <div style="position:relative;text-align: left">\n' +
|
|
16
|
-
' <textarea id="text__area0"> <img src="https://xdsoft.net/jodit/build/images/artio.jpg" style="border:1px solid red;width:100px;height:100px;"/></textarea>\n' +
|
|
17
|
-
' </div>\n' +
|
|
18
|
-
' </div>';
|
|
19
|
-
|
|
20
|
-
document.body.appendChild(div);
|
|
21
|
-
|
|
22
|
-
const editor = new Jodit('#text__area0');
|
|
23
|
-
simulateEvent('click', 0, editor.editor.querySelector('img'));
|
|
24
|
-
|
|
25
|
-
const resizer = document.querySelector(
|
|
26
|
-
'.jodit-resizer[data-editor_id=text__area0]'
|
|
27
|
-
);
|
|
28
|
-
expect(resizer).is.not.null;
|
|
29
|
-
|
|
30
|
-
const positionResizer = offset(resizer);
|
|
31
|
-
const positionImg = offset(editor.editor.querySelector('img'));
|
|
32
|
-
|
|
33
|
-
expect(Math.abs(positionResizer.left - positionImg.left) < 2).is
|
|
34
|
-
.true;
|
|
35
|
-
expect(Math.abs(positionResizer.top - positionImg.top) < 2).is
|
|
36
|
-
.true;
|
|
37
|
-
|
|
38
|
-
editor.destruct();
|
|
39
|
-
document.body.removeChild(div);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('After resize - popup', function () {
|
|
44
|
-
it('should be hidden and after this should be shown', function () {
|
|
45
|
-
const div = document.createElement('div');
|
|
46
|
-
div.innerHTML =
|
|
47
|
-
'<div style="width:800px; margin:auto; border:1px solid red;">\n' +
|
|
48
|
-
' wrong image selection\n' +
|
|
49
|
-
' <div style="position:relative;text-align: left">\n' +
|
|
50
|
-
' <textarea id="text__area1"> <img src="https://xdsoft.net/jodit/build/images/artio.jpg" style="border:1px solid red;width:100px;height:100px;"/></textarea>\n' +
|
|
51
|
-
' </div>\n' +
|
|
52
|
-
' </div>';
|
|
53
|
-
|
|
54
|
-
document.body.appendChild(div);
|
|
55
|
-
|
|
56
|
-
const editor = new Jodit(
|
|
57
|
-
document.getElementById('text__area1')
|
|
58
|
-
);
|
|
59
|
-
simulateEvent(
|
|
60
|
-
['mousedown', 'mouseup', 'click'],
|
|
61
|
-
0,
|
|
62
|
-
editor.editor.querySelector('img')
|
|
63
|
-
);
|
|
64
|
-
//
|
|
65
|
-
const popup = getOpenedPopup(editor);
|
|
66
|
-
//
|
|
67
|
-
expect(popup).is.not.null;
|
|
68
|
-
//
|
|
69
|
-
const resizer = editor.ownerDocument.querySelector(
|
|
70
|
-
'.jodit-resizer[data-editor_id=text__area1]'
|
|
71
|
-
);
|
|
72
|
-
expect(resizer).is.not.null;
|
|
73
|
-
//
|
|
74
|
-
const positionResizer = offset(resizer);
|
|
75
|
-
//
|
|
76
|
-
simulateEvent(
|
|
77
|
-
'mousedown',
|
|
78
|
-
0,
|
|
79
|
-
resizer.getElementsByTagName('i')[0]
|
|
80
|
-
);
|
|
81
|
-
simulateEvent(
|
|
82
|
-
'mousemove',
|
|
83
|
-
0,
|
|
84
|
-
editor.ownerWindow,
|
|
85
|
-
function (data) {
|
|
86
|
-
data.clientX = positionResizer.left - 10;
|
|
87
|
-
data.clientY = positionResizer.top - 10;
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
//
|
|
91
|
-
expect(popup.parentNode).is.null;
|
|
92
|
-
|
|
93
|
-
simulateEvent(
|
|
94
|
-
'mouseup',
|
|
95
|
-
0,
|
|
96
|
-
editor.ownerWindow,
|
|
97
|
-
function (data) {
|
|
98
|
-
data.clientX = positionResizer.left - 10;
|
|
99
|
-
data.clientY = positionResizer.top - 10;
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
expect(popup.parentNode).is.null;
|
|
104
|
-
//
|
|
105
|
-
editor.destruct();
|
|
106
|
-
div.parentNode && div.parentNode.removeChild(div);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
describe('Resize image', function () {
|
|
111
|
-
describe('Size box', function () {
|
|
112
|
-
it('Should show size for image', function (done) {
|
|
113
|
-
const editor = getJodit({
|
|
114
|
-
observer: {
|
|
115
|
-
timeout: 0
|
|
116
|
-
},
|
|
117
|
-
resizer: {
|
|
118
|
-
hideSizeTimeout: 400
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
editor.value =
|
|
122
|
-
'<img src="tests/artio.jpg" style="width:500px;height: 281px;"/>';
|
|
123
|
-
|
|
124
|
-
simulateEvent(
|
|
125
|
-
['mousedown', 'mouseup', 'click'],
|
|
126
|
-
editor.editor.querySelector('img')
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
const resizer = document.querySelector(
|
|
130
|
-
'.jodit-resizer[data-editor_id=' + editor.id + ']'
|
|
131
|
-
);
|
|
132
|
-
expect(resizer).is.not.null;
|
|
133
|
-
|
|
134
|
-
const sizer = resizer.querySelector('span');
|
|
135
|
-
expect(sizer).is.not.null;
|
|
136
|
-
expect(
|
|
137
|
-
editor.ownerWindow.getComputedStyle(sizer).opacity
|
|
138
|
-
).equals('0');
|
|
139
|
-
|
|
140
|
-
const positionResizer = offset(
|
|
141
|
-
resizer.getElementsByTagName('i')[1]
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
simulateEvent(
|
|
145
|
-
'mousedown',
|
|
146
|
-
0,
|
|
147
|
-
resizer.getElementsByTagName('i')[1]
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
simulateEvent(
|
|
151
|
-
'mousemove',
|
|
152
|
-
0,
|
|
153
|
-
editor.ownerWindow,
|
|
154
|
-
function (data) {
|
|
155
|
-
data.clientX = positionResizer.left + 10;
|
|
156
|
-
data.clientY = positionResizer.top + 10;
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
simulateEvent(
|
|
161
|
-
'mouseup',
|
|
162
|
-
0,
|
|
163
|
-
editor.ownerWindow,
|
|
164
|
-
function (data) {
|
|
165
|
-
data.clientX = positionResizer.left + 10;
|
|
166
|
-
data.clientY = positionResizer.top + 10;
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
expect(sizer.style.opacity).equals('1');
|
|
171
|
-
|
|
172
|
-
setTimeout(function () {
|
|
173
|
-
expect(sizer.style.opacity).equals('0');
|
|
174
|
-
done();
|
|
175
|
-
}, 500);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
describe('For small state', function () {
|
|
179
|
-
it('Should hide size', function () {
|
|
180
|
-
const editor = getJodit({
|
|
181
|
-
observer: {
|
|
182
|
-
timeout: 0
|
|
183
|
-
},
|
|
184
|
-
resizer: {
|
|
185
|
-
hideSizeTimeout: 400
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
editor.value =
|
|
190
|
-
'<img src="tests/artio.jpg" style="width:500px;height: 281px;"/>';
|
|
191
|
-
|
|
192
|
-
simulateEvent(
|
|
193
|
-
['mousedown', 'mouseup', 'click'],
|
|
194
|
-
editor.editor.querySelector('img')
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
const resizer = document.querySelector(
|
|
198
|
-
'.jodit-resizer[data-editor_id=' + editor.id + ']'
|
|
199
|
-
);
|
|
200
|
-
expect(resizer).is.not.null;
|
|
201
|
-
|
|
202
|
-
const sizer = resizer.querySelector('span');
|
|
203
|
-
expect(sizer).is.not.null;
|
|
204
|
-
expect(
|
|
205
|
-
editor.ownerWindow.getComputedStyle(sizer).opacity
|
|
206
|
-
).equals('0');
|
|
207
|
-
|
|
208
|
-
const positionResizer = offset(
|
|
209
|
-
resizer.getElementsByTagName('i')[2]
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
simulateEvent(
|
|
213
|
-
'mousedown',
|
|
214
|
-
resizer.getElementsByTagName('i')[2]
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
simulateEvent(
|
|
218
|
-
'mousemove',
|
|
219
|
-
editor.ownerWindow,
|
|
220
|
-
function (data) {
|
|
221
|
-
data.clientX = positionResizer.left - 480;
|
|
222
|
-
data.clientY = positionResizer.top - 200;
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
simulateEvent(
|
|
227
|
-
'mouseup',
|
|
228
|
-
editor.ownerWindow,
|
|
229
|
-
function (data) {
|
|
230
|
-
data.clientX = positionResizer.left - 480;
|
|
231
|
-
data.clientY = positionResizer.top - 200;
|
|
232
|
-
}
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
expect(sizer.style.opacity).equals('0');
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
it('Should not allow to resize image more then width of editor', function (done) {
|
|
241
|
-
getBox().style.width = '600px';
|
|
242
|
-
const editor = getJodit();
|
|
243
|
-
const image = new Image();
|
|
244
|
-
image.src = 'tests/artio.jpg';
|
|
245
|
-
|
|
246
|
-
const callback = function () {
|
|
247
|
-
const ratio = image.naturalWidth / image.naturalHeight;
|
|
248
|
-
|
|
249
|
-
editor.value =
|
|
250
|
-
'<img src="tests/artio.jpg" style="width:500px;height: 281px;"/>';
|
|
251
|
-
const img = editor.editor.querySelector('img');
|
|
252
|
-
simulateEvent(['mousedown', 'mouseup', 'click'], 0, img);
|
|
253
|
-
const resizer = document.querySelector(
|
|
254
|
-
'.jodit-resizer[data-editor_id=' + editor.id + ']'
|
|
255
|
-
);
|
|
256
|
-
expect(resizer).is.not.null;
|
|
257
|
-
|
|
258
|
-
const positionResizer = offset(resizer);
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
simulateEvent(
|
|
262
|
-
'mousedown',
|
|
263
|
-
0,
|
|
264
|
-
resizer.getElementsByTagName('i')[1]
|
|
265
|
-
);
|
|
266
|
-
simulateEvent(
|
|
267
|
-
'mousemove',
|
|
268
|
-
0,
|
|
269
|
-
editor.ownerWindow,
|
|
270
|
-
function (data) {
|
|
271
|
-
data.clientX = positionResizer.left + 1000;
|
|
272
|
-
data.clientY = positionResizer.top + 1000;
|
|
273
|
-
}
|
|
274
|
-
);
|
|
275
|
-
|
|
276
|
-
simulateEvent(
|
|
277
|
-
'mouseup',
|
|
278
|
-
0,
|
|
279
|
-
editor.ownerWindow,
|
|
280
|
-
function (data) {
|
|
281
|
-
data.clientX = positionResizer.left + 1000;
|
|
282
|
-
data.clientY = positionResizer.top + 1000;
|
|
283
|
-
}
|
|
284
|
-
);
|
|
285
|
-
const newratio = img.offsetWidth / img.offsetHeight;
|
|
286
|
-
|
|
287
|
-
expect(img.offsetWidth).equals(
|
|
288
|
-
editor.editor.offsetWidth - 16
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
expect(Math.abs(newratio - ratio) < 0.003).is.true;
|
|
292
|
-
done();
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
onLoadImage(image, callback);
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
describe('For iframes', function () {
|
|
301
|
-
it('should wrap these iframes inside JODIT tag', function () {
|
|
302
|
-
const editor = getJodit();
|
|
303
|
-
editor.value =
|
|
304
|
-
'<iframe style="border: 0px currentColor; border-image: none;" src="https://www.google.com/maps/embed" frameborder="0" width="100%" height="500"></iframe>' +
|
|
305
|
-
'<iframe style="border: 0px currentColor; border-image: none;" src="https://www.google.com/maps/embed" frameborder="0" width="100%" height="500"></iframe>';
|
|
306
|
-
|
|
307
|
-
expect(editor.editor.querySelectorAll('jodit').length).equals(2);
|
|
308
|
-
expect(
|
|
309
|
-
editor.editor.querySelector('jodit').firstChild.tagName
|
|
310
|
-
).equals('IFRAME');
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
describe('Output HTML', function () {
|
|
314
|
-
it('should not contains JODIT tag', function () {
|
|
315
|
-
const editor = getJodit();
|
|
316
|
-
editor.value =
|
|
317
|
-
'<iframe style="border: 0px currentColor; border-image: none;" src="https://www.google.com/maps/embed" frameborder="0" width="100%" height="500"></iframe>' +
|
|
318
|
-
'<iframe style="border: 0px currentColor; border-image: none;" src="https://www.google.com/maps/embed" frameborder="0" width="100%" height="500"></iframe>';
|
|
319
|
-
|
|
320
|
-
expect(editor.editor.querySelectorAll('jodit').length).equals(
|
|
321
|
-
2
|
|
322
|
-
);
|
|
323
|
-
expect(sortAttributes(editor.value)).equals(
|
|
324
|
-
'<iframe frameborder="0" height="500" src="https://www.google.com/maps/embed" style="border:0px currentColor" width="100%"></iframe><iframe frameborder="0" height="500" src="https://www.google.com/maps/embed" style="border:0px currentColor" width="100%"></iframe>'
|
|
325
|
-
);
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
});
|