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,310 +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 states', function () {
|
|
7
|
-
describe('ReadOnly', function () {
|
|
8
|
-
describe('Set readonly mode in options', function () {
|
|
9
|
-
describe('Readonly', function () {
|
|
10
|
-
it('Should deny edit content in simple source editor', function () {
|
|
11
|
-
const editor = getJodit({
|
|
12
|
-
readonly: true,
|
|
13
|
-
sourceEditor: 'area'
|
|
14
|
-
});
|
|
15
|
-
editor.setMode(Jodit.MODE_SOURCE);
|
|
16
|
-
expect(true).equals(
|
|
17
|
-
editor.__plugins.source.sourceEditor.instance.hasAttribute(
|
|
18
|
-
'readonly'
|
|
19
|
-
)
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe('For iframe', function () {
|
|
25
|
-
it("Should deny edit content in iframe's body", function (done) {
|
|
26
|
-
unmockPromise();
|
|
27
|
-
|
|
28
|
-
getJodit({
|
|
29
|
-
readonly: true,
|
|
30
|
-
iframe: true,
|
|
31
|
-
events: {
|
|
32
|
-
afterConstructor: function (jodit) {
|
|
33
|
-
expect(false).equals(
|
|
34
|
-
jodit.editor.hasAttribute('contenteditable')
|
|
35
|
-
);
|
|
36
|
-
expect('BODY').equals(jodit.editor.nodeName);
|
|
37
|
-
done();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('Should deny edit content in wysiwyg', function () {
|
|
45
|
-
const editor = getJodit({
|
|
46
|
-
readonly: true
|
|
47
|
-
});
|
|
48
|
-
expect(false).equals(
|
|
49
|
-
editor.editor.hasAttribute('contenteditable')
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('Should deny exec any commands', function () {
|
|
54
|
-
const editor = getJodit({
|
|
55
|
-
readonly: true
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
editor.value = 'test';
|
|
59
|
-
|
|
60
|
-
editor.s.select(editor.editor.firstChild);
|
|
61
|
-
|
|
62
|
-
editor.execCommand('bold');
|
|
63
|
-
|
|
64
|
-
expect(editor.value).equals('<p>test</p>');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('Should disable all toolbar buttons besides source, print, about, fullsize', function () {
|
|
68
|
-
const editor = getJodit({
|
|
69
|
-
readonly: true,
|
|
70
|
-
toolbarAdaptive: false,
|
|
71
|
-
observer: {
|
|
72
|
-
timeout: 0
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
editor.value = 'test';
|
|
77
|
-
const buttons = [].slice.call(
|
|
78
|
-
editor.container.querySelectorAll('.jodit-toolbar-button')
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
expect(buttons.length).is.above(0);
|
|
82
|
-
|
|
83
|
-
buttons.forEach(function (btn) {
|
|
84
|
-
if (
|
|
85
|
-
!/(source|print|about|fullsize|separator|selectall|break)/.test(
|
|
86
|
-
btn.className
|
|
87
|
-
)
|
|
88
|
-
) {
|
|
89
|
-
expect(btn.hasAttribute('disabled')).is.true;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe('Readonly for ACE', function () {
|
|
95
|
-
it('Should deny edit content in ace source editor', function (done) {
|
|
96
|
-
unmockPromise();
|
|
97
|
-
|
|
98
|
-
const editor = getJodit({
|
|
99
|
-
readonly: true,
|
|
100
|
-
sourceEditor: 'ace',
|
|
101
|
-
events: {
|
|
102
|
-
sourceEditorReady: function (editor) {
|
|
103
|
-
expect(null).is.not.equal(
|
|
104
|
-
editor.__plugins.source.sourceEditor
|
|
105
|
-
.instance
|
|
106
|
-
);
|
|
107
|
-
expect(true).equals(
|
|
108
|
-
editor.__plugins.source.sourceEditor.instance.getReadOnly()
|
|
109
|
-
);
|
|
110
|
-
mockPromise();
|
|
111
|
-
|
|
112
|
-
done();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
editor.setMode(Jodit.MODE_SOURCE);
|
|
118
|
-
}).timeout(6000);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
describe('Search plugin', function () {
|
|
122
|
-
describe('CTRL + H', function () {
|
|
123
|
-
describe('In readonly editor', function () {
|
|
124
|
-
it('Should be deny', function () {
|
|
125
|
-
const editor = getJodit({
|
|
126
|
-
readonly: true,
|
|
127
|
-
observer: {
|
|
128
|
-
timeout: 0
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
const search =
|
|
133
|
-
editor.container.querySelector('.jodit-search');
|
|
134
|
-
expect(false).equals(
|
|
135
|
-
search.classList.contains('jodit-search_active')
|
|
136
|
-
);
|
|
137
|
-
simulateEvent(
|
|
138
|
-
'keydown',
|
|
139
|
-
Jodit.KEY_H,
|
|
140
|
-
editor.editor,
|
|
141
|
-
function (options) {
|
|
142
|
-
options.ctrlKey = true;
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
expect(false).equals(
|
|
146
|
-
search.classList.contains('jodit-search_active')
|
|
147
|
-
);
|
|
148
|
-
expect(false).equals(
|
|
149
|
-
search.classList.contains(
|
|
150
|
-
'jodit-search_replace'
|
|
151
|
-
)
|
|
152
|
-
);
|
|
153
|
-
expect(false).equals(
|
|
154
|
-
editor.ownerDocument.activeElement ===
|
|
155
|
-
search.querySelector('.jodit-search__query')
|
|
156
|
-
);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe('Method get read only', function () {
|
|
163
|
-
it('Should return enable/disable readonly', function () {
|
|
164
|
-
const editor = getJodit({
|
|
165
|
-
readonly: true
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
expect(true).equals(editor.getReadOnly());
|
|
169
|
-
editor.setReadOnly(false);
|
|
170
|
-
expect(false).equals(editor.getReadOnly());
|
|
171
|
-
editor.destruct();
|
|
172
|
-
|
|
173
|
-
const editor2 = getJodit();
|
|
174
|
-
expect(false).equals(editor2.getReadOnly());
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
describe('Set readonly mode by source element attribute', function () {
|
|
180
|
-
it('Should work like by options', function () {
|
|
181
|
-
const area = appendTestArea();
|
|
182
|
-
|
|
183
|
-
area.setAttribute('readonly', 'true');
|
|
184
|
-
|
|
185
|
-
const editor = new Jodit(area);
|
|
186
|
-
|
|
187
|
-
expect(editor.editor.hasAttribute('contenteditable')).is.false;
|
|
188
|
-
expect(editor.getReadOnly()).is.true;
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
describe('In short form', function () {
|
|
192
|
-
it('Should work like by options', function () {
|
|
193
|
-
const area = appendTestArea();
|
|
194
|
-
|
|
195
|
-
area.setAttribute('readonly', '');
|
|
196
|
-
|
|
197
|
-
const editor = new Jodit(area);
|
|
198
|
-
|
|
199
|
-
expect(editor.editor.hasAttribute('contenteditable')).is
|
|
200
|
-
.false;
|
|
201
|
-
expect(editor.getReadOnly()).is.true;
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
describe('Disable readonly mode', function () {
|
|
207
|
-
it('Should allow edit content in wysiwyg', function () {
|
|
208
|
-
const editor = getJodit({
|
|
209
|
-
readonly: true
|
|
210
|
-
});
|
|
211
|
-
expect(false).equals(
|
|
212
|
-
editor.editor.hasAttribute('contenteditable')
|
|
213
|
-
);
|
|
214
|
-
editor.setReadOnly(false);
|
|
215
|
-
expect(true).equals(
|
|
216
|
-
editor.editor.hasAttribute('contenteditable')
|
|
217
|
-
);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it('Should allow edit content in simple source editor', function () {
|
|
221
|
-
const editor = getJodit({
|
|
222
|
-
readonly: true,
|
|
223
|
-
sourceEditor: 'area'
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
editor.setMode(Jodit.MODE_SOURCE);
|
|
227
|
-
expect(true).equals(
|
|
228
|
-
editor.__plugins.source.sourceEditor.instance.hasAttribute(
|
|
229
|
-
'readonly'
|
|
230
|
-
)
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
editor.setReadOnly(false);
|
|
234
|
-
|
|
235
|
-
expect(false).equals(
|
|
236
|
-
editor.__plugins.source.sourceEditor.instance.hasAttribute(
|
|
237
|
-
'readonly'
|
|
238
|
-
)
|
|
239
|
-
);
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it('Should allow edit content in ace source editor', function (done) {
|
|
243
|
-
unmockPromise();
|
|
244
|
-
|
|
245
|
-
const editor = getJodit({
|
|
246
|
-
readonly: true,
|
|
247
|
-
sourceEditor: 'ace',
|
|
248
|
-
defaultMode: Jodit.MODE_SOURCE,
|
|
249
|
-
events: {
|
|
250
|
-
sourceEditorReady: function (editor) {
|
|
251
|
-
expect(null).does.not.equal(
|
|
252
|
-
editor.__plugins.source.sourceEditor.instance
|
|
253
|
-
);
|
|
254
|
-
expect(true).equals(
|
|
255
|
-
editor.__plugins.source.sourceEditor.instance.getReadOnly()
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
editor.setReadOnly(false);
|
|
259
|
-
expect(false).equals(
|
|
260
|
-
editor.__plugins.source.sourceEditor.instance.getReadOnly()
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
mockPromise();
|
|
264
|
-
|
|
265
|
-
done();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
editor.setMode(Jodit.MODE_SOURCE);
|
|
271
|
-
}).timeout(6000);
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
describe('Disabled', function () {
|
|
276
|
-
describe('Set disabled mode in options', function () {
|
|
277
|
-
it("Should enable readonly mode too and editor's container should have jodit_disabled class", function () {
|
|
278
|
-
const area = appendTestArea();
|
|
279
|
-
|
|
280
|
-
area.setAttribute('disabled', 'true');
|
|
281
|
-
|
|
282
|
-
const editor = new Jodit(area);
|
|
283
|
-
|
|
284
|
-
expect(editor.container.classList.contains('jodit_disabled')).is
|
|
285
|
-
.true;
|
|
286
|
-
expect(editor.editor.hasAttribute('contenteditable')).is.false;
|
|
287
|
-
expect(editor.getReadOnly()).is.true;
|
|
288
|
-
expect(editor.getDisabled()).is.true;
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
describe('Switch disabled mode', function () {
|
|
292
|
-
it('Should enable readonly if true but set default readonly mode in false', function () {
|
|
293
|
-
const area = appendTestArea();
|
|
294
|
-
|
|
295
|
-
area.setAttribute('disabled', 'true');
|
|
296
|
-
area.setAttribute('readonly', 'true');
|
|
297
|
-
|
|
298
|
-
const editor = new Jodit(area);
|
|
299
|
-
|
|
300
|
-
expect(editor.getReadOnly()).is.true;
|
|
301
|
-
expect(editor.getDisabled()).is.true;
|
|
302
|
-
|
|
303
|
-
editor.setDisabled(false);
|
|
304
|
-
|
|
305
|
-
expect(editor.getReadOnly()).is.true;
|
|
306
|
-
expect(editor.getDisabled()).is.false;
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
});
|