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,81 +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('Test i18n functionality', function () {
|
|
7
|
-
describe('Test has keys in all functionality', function () {
|
|
8
|
-
const filter = [
|
|
9
|
-
'customxxx',
|
|
10
|
-
'customxxx',
|
|
11
|
-
'Ok',
|
|
12
|
-
'Link',
|
|
13
|
-
'Code',
|
|
14
|
-
'Embed code',
|
|
15
|
-
'Normal',
|
|
16
|
-
'Text',
|
|
17
|
-
'Split',
|
|
18
|
-
'Jodit Editor',
|
|
19
|
-
'License: %s',
|
|
20
|
-
'Split vertical',
|
|
21
|
-
'Src',
|
|
22
|
-
'Edit',
|
|
23
|
-
'Split horizontal',
|
|
24
|
-
'Styles',
|
|
25
|
-
'Classes',
|
|
26
|
-
'Alternative',
|
|
27
|
-
'Image',
|
|
28
|
-
'Border'
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
Object.keys(Jodit.lang)
|
|
32
|
-
.filter(function (language) {
|
|
33
|
-
return language !== 'en';
|
|
34
|
-
})
|
|
35
|
-
.forEach(function (language) {
|
|
36
|
-
it(
|
|
37
|
-
'Should have value for all key in ' +
|
|
38
|
-
language +
|
|
39
|
-
' language',
|
|
40
|
-
function () {
|
|
41
|
-
const editor = getJodit({
|
|
42
|
-
language: language,
|
|
43
|
-
debugLanguage: true
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
i18nkeys
|
|
47
|
-
.filter(function (key) {
|
|
48
|
-
return (
|
|
49
|
-
filter.indexOf(key) === -1 &&
|
|
50
|
-
!/^[0-9]+(pt|px)?$/.test(key)
|
|
51
|
-
);
|
|
52
|
-
})
|
|
53
|
-
.forEach(function (key) {
|
|
54
|
-
expect('{' + key + '}').does.not.equal(
|
|
55
|
-
editor.i18n(key)
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
describe('Test i18n function', function () {
|
|
63
|
-
it('Should show value in current language', function () {
|
|
64
|
-
const editor = getJodit({
|
|
65
|
-
language: 'ru',
|
|
66
|
-
i18n: {
|
|
67
|
-
ru: {
|
|
68
|
-
'Test %s': 'Тест %s',
|
|
69
|
-
'Test %d': 'Тест %d',
|
|
70
|
-
'Test %s %d': 'Тест %s %d'
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
expect(editor.i18n('Type something')).equals('Напишите что-либо');
|
|
75
|
-
expect(editor.i18n('Test %s', 'строка')).equals('Тест строка');
|
|
76
|
-
expect(editor.i18n('Test %s %d', 'строка', 1)).equals(
|
|
77
|
-
'Тест строка 1'
|
|
78
|
-
);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,306 +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('Iframe mode', function () {
|
|
7
|
-
describe('Create editor with iframe mode', function () {
|
|
8
|
-
it('Should create editable area in another document', function (done) {
|
|
9
|
-
unmockPromise();
|
|
10
|
-
Jodit.make(appendTestArea(), {
|
|
11
|
-
iframe: true,
|
|
12
|
-
events: {
|
|
13
|
-
afterConstructor: function (editor) {
|
|
14
|
-
expect(editor.ownerDocument).does.not.equal(editor.ed);
|
|
15
|
-
expect('true').equals(
|
|
16
|
-
editor.ed.body.getAttribute('contenteditable')
|
|
17
|
-
);
|
|
18
|
-
done();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe('And exec command', function () {
|
|
25
|
-
it('Should use body like editor area', function (done) {
|
|
26
|
-
unmockPromise();
|
|
27
|
-
Jodit.make(appendTestArea(), {
|
|
28
|
-
iframe: true,
|
|
29
|
-
events: {
|
|
30
|
-
afterConstructor: function (editor) {
|
|
31
|
-
mockPromise();
|
|
32
|
-
editor.value = 'test test stop';
|
|
33
|
-
|
|
34
|
-
expect(editor.ed.body.innerHTML).equals(
|
|
35
|
-
'<p>test test stop</p>'
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const range = editor.s.createRange();
|
|
39
|
-
range.selectNodeContents(editor.ed.body);
|
|
40
|
-
editor.s.selectRange(range);
|
|
41
|
-
|
|
42
|
-
editor.execCommand('bold');
|
|
43
|
-
|
|
44
|
-
expect(editor.ed.body.innerHTML).equals(
|
|
45
|
-
'<p><strong>test test stop</strong></p>'
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
done();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe('Set value right after construct', function () {
|
|
56
|
-
it('Should set/get value without some trouble', function () {
|
|
57
|
-
const area = appendTestArea();
|
|
58
|
-
|
|
59
|
-
area.value = 'stop';
|
|
60
|
-
|
|
61
|
-
const editor = new Jodit(area, {
|
|
62
|
-
iframe: true
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
expect(editor.value).equals('<p>stop</p>');
|
|
66
|
-
editor.value = 'test1';
|
|
67
|
-
expect(editor.value).equals('<p>test1</p>');
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('Enable editHTMLDocumentMode', function () {
|
|
72
|
-
describe('With DIV source element', function () {
|
|
73
|
-
it('Should throw error', function () {
|
|
74
|
-
const div = appendTestDiv();
|
|
75
|
-
|
|
76
|
-
expect(function () {
|
|
77
|
-
Jodit.make(div, {
|
|
78
|
-
iframe: true,
|
|
79
|
-
editHTMLDocumentMode: true
|
|
80
|
-
});
|
|
81
|
-
}).throws(TypeError);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
describe('With AREA source element', function () {
|
|
86
|
-
const opt = {
|
|
87
|
-
iframe: true,
|
|
88
|
-
iframeTitle: 'Hi',
|
|
89
|
-
disablePlugins: ['size'],
|
|
90
|
-
height: 300,
|
|
91
|
-
iframeStyle: '',
|
|
92
|
-
iframeCSSLinks: [],
|
|
93
|
-
editHTMLDocumentMode: true
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
it('Should work fine', function () {
|
|
97
|
-
const area = appendTestArea();
|
|
98
|
-
|
|
99
|
-
expect(function () {
|
|
100
|
-
Jodit.make(area, opt);
|
|
101
|
-
}).does.not.throws(TypeError);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('editor.value', function () {
|
|
105
|
-
it('Should return entire HTML', function () {
|
|
106
|
-
const editor = Jodit.make(appendTestArea(), opt);
|
|
107
|
-
|
|
108
|
-
expect(
|
|
109
|
-
sortAttributes(
|
|
110
|
-
editor.value
|
|
111
|
-
.replace(/[\t\n]/g, '')
|
|
112
|
-
.replace(/<br>/g, '')
|
|
113
|
-
)
|
|
114
|
-
).equals(
|
|
115
|
-
'<!DOCTYPE html><html lang="en">' +
|
|
116
|
-
'<head><title>Hi</title></head>' +
|
|
117
|
-
'<body spellcheck="true" ></body>' +
|
|
118
|
-
'</html>'
|
|
119
|
-
);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
describe('Set some part of HTML', function () {
|
|
123
|
-
it('Should insert this part inside BODY', function () {
|
|
124
|
-
const editor = Jodit.make(appendTestArea(), opt);
|
|
125
|
-
editor.value = '<strong>Test</strong>';
|
|
126
|
-
|
|
127
|
-
expect(
|
|
128
|
-
sortAttributes(
|
|
129
|
-
editor.value
|
|
130
|
-
.replace(/[\t\n]/g, '')
|
|
131
|
-
.replace(/<br>/g, '')
|
|
132
|
-
)
|
|
133
|
-
).equals(
|
|
134
|
-
'<!DOCTYPE html><html lang="en">' +
|
|
135
|
-
'<head><title>Hi</title></head>' +
|
|
136
|
-
'<body spellcheck="true" >' +
|
|
137
|
-
'<p><strong>Test</strong></p></body></html>'
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
describe('Set entire HTML', function () {
|
|
143
|
-
it('Should replace entire document', function () {
|
|
144
|
-
const editor = Jodit.make(appendTestArea(), opt);
|
|
145
|
-
editor.value =
|
|
146
|
-
'<!DOCTYPE html><html lang="en"><head><title>Hi</title></head><body><strong>Test1</strong></body></html>';
|
|
147
|
-
|
|
148
|
-
expect(
|
|
149
|
-
sortAttributes(
|
|
150
|
-
editor.value
|
|
151
|
-
.replace(/[\t\n]/g, '')
|
|
152
|
-
.replace(/ {2,}/g, ' ')
|
|
153
|
-
.replace(/[\s]+>/g, '>')
|
|
154
|
-
)
|
|
155
|
-
).equals(
|
|
156
|
-
'<!DOCTYPE html><html lang="en"><head><title>Hi</title></head><body spellcheck="true"><p><strong>Test1</strong></p></body></html>'
|
|
157
|
-
);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe('Change event', function () {
|
|
164
|
-
it('should work like in usual case', function () {
|
|
165
|
-
const editor = getJodit({
|
|
166
|
-
editHTMLDocumentMode: true,
|
|
167
|
-
iframe: true,
|
|
168
|
-
iframeStyle: '',
|
|
169
|
-
iframeCSSLinks: Jodit.atom([])
|
|
170
|
-
});
|
|
171
|
-
editor.value = 'Some text';
|
|
172
|
-
|
|
173
|
-
let changeCounter = 0;
|
|
174
|
-
const onChange = function () {
|
|
175
|
-
changeCounter += 1;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
editor.e.on('change', onChange);
|
|
179
|
-
editor.value = 'Some text2';
|
|
180
|
-
expect(changeCounter).equals(1);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
describe('Change mode', function () {
|
|
184
|
-
it('should work like in usual case', function () {
|
|
185
|
-
const editor = getJodit({
|
|
186
|
-
editHTMLDocumentMode: true,
|
|
187
|
-
sourceEdiotor: 'area',
|
|
188
|
-
iframe: true,
|
|
189
|
-
iframeStyle: '',
|
|
190
|
-
iframeCSSLinks: Jodit.atom([])
|
|
191
|
-
});
|
|
192
|
-
editor.value = 'Some text';
|
|
193
|
-
|
|
194
|
-
let changeCounter = 0;
|
|
195
|
-
const onChange = function () {
|
|
196
|
-
changeCounter += 1;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
editor.e.on('change', onChange);
|
|
200
|
-
editor.s.insertHTML('Some text1');
|
|
201
|
-
editor.s.insertHTML('Some text2');
|
|
202
|
-
|
|
203
|
-
expect(changeCounter).equals(2);
|
|
204
|
-
|
|
205
|
-
editor.toggleMode();
|
|
206
|
-
expect(changeCounter).equals(3);
|
|
207
|
-
|
|
208
|
-
editor.__plugins.source.sourceEditor.instance.value =
|
|
209
|
-
'Some text3';
|
|
210
|
-
editor.e.fire(
|
|
211
|
-
'change',
|
|
212
|
-
editor.__plugins.source.sourceEditor.instance
|
|
213
|
-
);
|
|
214
|
-
expect(changeCounter).equals(4);
|
|
215
|
-
|
|
216
|
-
editor.toggleMode();
|
|
217
|
-
editor.editor.appendChild(
|
|
218
|
-
editor.createInside.text('x')
|
|
219
|
-
);
|
|
220
|
-
simulateEvent('keydown', 'x', editor.editor);
|
|
221
|
-
|
|
222
|
-
expect(changeCounter).above(5);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
describe('Define document for iframe from some site', function () {
|
|
230
|
-
it('Should work perfect', function (done) {
|
|
231
|
-
unmockPromise();
|
|
232
|
-
const area = appendTestArea();
|
|
233
|
-
|
|
234
|
-
area.value = '<p>start value</p>';
|
|
235
|
-
|
|
236
|
-
Jodit.make(area, {
|
|
237
|
-
iframe: true,
|
|
238
|
-
events: {
|
|
239
|
-
afterConstructor: function (jodit) {
|
|
240
|
-
expect(
|
|
241
|
-
jodit.editor.getAttribute('secret-attribute')
|
|
242
|
-
).equals('435'); // loaded from index.html
|
|
243
|
-
expect(Jodit.ns.Helpers.trim(jodit.value)).equals(
|
|
244
|
-
'<p>test 435</p>'
|
|
245
|
-
); // loaded from index.html
|
|
246
|
-
done();
|
|
247
|
-
},
|
|
248
|
-
beforeSetValueToEditor: function () {
|
|
249
|
-
return false;
|
|
250
|
-
},
|
|
251
|
-
['generateDocumentStructure.iframe']: function (
|
|
252
|
-
doc,
|
|
253
|
-
jodit
|
|
254
|
-
) {
|
|
255
|
-
jodit.events.stopPropagation(
|
|
256
|
-
'generateDocumentStructure.iframe'
|
|
257
|
-
);
|
|
258
|
-
return new Promise(resolve => {
|
|
259
|
-
jodit.iframe.onload = function () {
|
|
260
|
-
resolve();
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
setTimeout(function () {
|
|
264
|
-
resolve();
|
|
265
|
-
}, 4000);
|
|
266
|
-
|
|
267
|
-
jodit.iframe.src = 'test.index.html';
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
}).timeout(5000);
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
describe('Editor inside iframe', function () {
|
|
277
|
-
describe('In creator doc field', function () {
|
|
278
|
-
it('Should be iframe.contentDocument', function () {
|
|
279
|
-
const iframe = document.createElement('iframe');
|
|
280
|
-
iframe.style.width = '900px';
|
|
281
|
-
getBox().appendChild(iframe);
|
|
282
|
-
|
|
283
|
-
const win = iframe.contentWindow;
|
|
284
|
-
const doc = win.document;
|
|
285
|
-
doc.open();
|
|
286
|
-
doc.write(
|
|
287
|
-
'<html lang="en"><body><textarea id="editor"></textarea><' +
|
|
288
|
-
'script src="./build/jodit.js"><' +
|
|
289
|
-
'/script></body></html>'
|
|
290
|
-
);
|
|
291
|
-
doc.close();
|
|
292
|
-
|
|
293
|
-
const editor = new Jodit('#editor', {
|
|
294
|
-
ownerWindow: win,
|
|
295
|
-
ownerDocument: doc
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
expect(editor.create.doc).does.not.equal(document);
|
|
299
|
-
expect(editor.create.doc).equals(doc);
|
|
300
|
-
expect(editor.createInside.doc).equals(doc);
|
|
301
|
-
|
|
302
|
-
editor.destruct();
|
|
303
|
-
Jodit.modules.Dom.safeRemove(iframe);
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
});
|