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,172 +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('Drag and drop element inside Editor', function () {
|
|
7
|
-
['mousedown|mousemove|mouseup', 'touchstart|touchmove|touchend']
|
|
8
|
-
.map(function (item) {
|
|
9
|
-
return item.split('|');
|
|
10
|
-
})
|
|
11
|
-
.forEach(function (events) {
|
|
12
|
-
describe(
|
|
13
|
-
events[0] + ' and move image inside the editor',
|
|
14
|
-
function () {
|
|
15
|
-
it('Should ' + events[1] + ' dom element', function () {
|
|
16
|
-
const editor = getJodit();
|
|
17
|
-
editor.value =
|
|
18
|
-
'<p>1111</p>' +
|
|
19
|
-
'<p>2222</p>' +
|
|
20
|
-
'<img style="width: 100px" src="https://xdsoft.net/jodit/build/images/artio.jpg" alt="">' +
|
|
21
|
-
'<p>3333</p>' +
|
|
22
|
-
'<p>4444</p>';
|
|
23
|
-
|
|
24
|
-
simulateEvent(
|
|
25
|
-
events[0],
|
|
26
|
-
0,
|
|
27
|
-
editor.editor.getElementsByTagName('img')[0]
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
window.scrollTo(0, 1000000);
|
|
31
|
-
|
|
32
|
-
const box = Jodit.modules.Helpers.position(
|
|
33
|
-
editor.editor.querySelectorAll('p')[1],
|
|
34
|
-
editor
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
simulateEvent(
|
|
38
|
-
events[1],
|
|
39
|
-
0,
|
|
40
|
-
editor.editor,
|
|
41
|
-
function (options) {
|
|
42
|
-
options.clientX = box.left + 15;
|
|
43
|
-
options.clientY = box.top + 5;
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
simulateEvent(
|
|
48
|
-
events[2],
|
|
49
|
-
0,
|
|
50
|
-
editor.editor,
|
|
51
|
-
function (options) {
|
|
52
|
-
options.clientX = box.left + 15;
|
|
53
|
-
options.clientY = box.top + 5;
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const result =
|
|
58
|
-
'<p>1111</p>' +
|
|
59
|
-
'<p>22<img alt="" src="https://xdsoft.net/jodit/build/images/artio.jpg" style="width:100px">22</p>' +
|
|
60
|
-
'<p>3333</p>' +
|
|
61
|
-
'<p>4444</p>';
|
|
62
|
-
|
|
63
|
-
expect(
|
|
64
|
-
sortAttributes(editor.value).replace(/2+/g, '2')
|
|
65
|
-
).equals(result.replace(/2+/g, '2'));
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
describe(events[1] + ' image inside anchor', function () {
|
|
71
|
-
it('Should ' + events[1] + ' anchor with image', function () {
|
|
72
|
-
const editor = getJodit();
|
|
73
|
-
|
|
74
|
-
editor.value =
|
|
75
|
-
'<p>1111</p>' +
|
|
76
|
-
'<p>2222</p>' +
|
|
77
|
-
'<a href="#test"><img style="width: 100px" src="https://xdsoft.net/jodit/build/images/artio.jpg" alt=""></a>' +
|
|
78
|
-
'<p>3333</p>' +
|
|
79
|
-
'<p>4444</p>';
|
|
80
|
-
|
|
81
|
-
simulateEvent(
|
|
82
|
-
events[0],
|
|
83
|
-
0,
|
|
84
|
-
editor.editor.getElementsByTagName('img')[0]
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
window.scrollTo(0, 1000000);
|
|
88
|
-
|
|
89
|
-
const box = Jodit.modules.Helpers.position(
|
|
90
|
-
editor.editor.querySelectorAll('p')[1],
|
|
91
|
-
editor
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
simulateEvent(
|
|
95
|
-
events[1],
|
|
96
|
-
0,
|
|
97
|
-
editor.editor,
|
|
98
|
-
function (options) {
|
|
99
|
-
options.clientX = box.left + 15;
|
|
100
|
-
options.clientY = box.top + 5;
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
simulateEvent(
|
|
105
|
-
events[2],
|
|
106
|
-
0,
|
|
107
|
-
editor.editor,
|
|
108
|
-
function (options) {
|
|
109
|
-
options.clientX = box.left + 20;
|
|
110
|
-
options.clientY = box.top + 5;
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
expect(editor.value.replace(/2+/g, '2')).equals(
|
|
115
|
-
'<p>1111</p><p>22<a href="#test"><img style="width: 100px" src="https://xdsoft.net/jodit/build/images/artio.jpg" alt=""></a>22</p><p>3333</p><p>4444</p>'.replace(
|
|
116
|
-
/2+/g,
|
|
117
|
-
'2'
|
|
118
|
-
)
|
|
119
|
-
);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
describe('Disable dragging', function () {
|
|
124
|
-
it('Should not move image', function () {
|
|
125
|
-
const editor = getJodit({
|
|
126
|
-
draggableTags: []
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const defaultValue =
|
|
130
|
-
'<p>1111</p>' +
|
|
131
|
-
'<p>2222</p>' +
|
|
132
|
-
'<p><a href="#test"><img style="width: 100px" src="https://xdsoft.net/jodit/build/images/artio.jpg" alt=""></a></p>' +
|
|
133
|
-
'<p>3333</p>' +
|
|
134
|
-
'<p>4444</p>';
|
|
135
|
-
|
|
136
|
-
editor.value = defaultValue;
|
|
137
|
-
|
|
138
|
-
simulateEvent(
|
|
139
|
-
events[0],
|
|
140
|
-
0,
|
|
141
|
-
editor.editor.getElementsByTagName('img')[0]
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
const box = Jodit.modules.Helpers.position(
|
|
145
|
-
editor.editor.querySelectorAll('p')[1],
|
|
146
|
-
editor
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
simulateEvent(
|
|
150
|
-
events[1],
|
|
151
|
-
0,
|
|
152
|
-
editor.editor,
|
|
153
|
-
function (options) {
|
|
154
|
-
options.clientX = box.left + 15;
|
|
155
|
-
options.clientY = box.top + 5;
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
simulateEvent(
|
|
159
|
-
events[2],
|
|
160
|
-
0,
|
|
161
|
-
editor.editor,
|
|
162
|
-
function (options) {
|
|
163
|
-
options.clientX = box.left + 20;
|
|
164
|
-
options.clientY = box.top + 5;
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
expect(editor.value).equals(defaultValue);
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
@@ -1,115 +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('Focus test', () => {
|
|
7
|
-
describe('Enable autofocus', () => {
|
|
8
|
-
it('Should set focus inside editor after init', () => {
|
|
9
|
-
const editor = getJodit({
|
|
10
|
-
autofocus: true,
|
|
11
|
-
observer: {
|
|
12
|
-
defaultTimeout: 0
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
expect(editor.ew.getSelection().getRangeAt(0).startContainer).eq(
|
|
17
|
-
editor.editor
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('Cursor position', () => {
|
|
22
|
-
describe('By default', () => {
|
|
23
|
-
it('Should set cursor after content', () => {
|
|
24
|
-
const area = appendTestArea();
|
|
25
|
-
|
|
26
|
-
area.value = '<p>test <span>text</span></p>';
|
|
27
|
-
|
|
28
|
-
const editor = getJodit(
|
|
29
|
-
{
|
|
30
|
-
autofocus: true,
|
|
31
|
-
observer: {
|
|
32
|
-
defaultTimeout: 0
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
area
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
editor.s.insertHTML('pop');
|
|
39
|
-
|
|
40
|
-
expect(editor.value).eq('<p>test <span>textpop</span></p>');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
describe('In the start', () => {
|
|
45
|
-
it('Should set cursor before content', () => {
|
|
46
|
-
const area = appendTestArea();
|
|
47
|
-
|
|
48
|
-
area.value = '<p>test <span>text</span></p>';
|
|
49
|
-
|
|
50
|
-
const editor = getJodit(
|
|
51
|
-
{
|
|
52
|
-
autofocus: true,
|
|
53
|
-
cursorAfterAutofocus: 'start',
|
|
54
|
-
observer: {
|
|
55
|
-
defaultTimeout: 0
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
area
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
editor.s.insertHTML('pop');
|
|
62
|
-
|
|
63
|
-
expect(editor.value).eq('<p>poptest <span>text</span></p>');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
describe('Save cursor position after blur', () => {
|
|
70
|
-
describe('Enable', () => {
|
|
71
|
-
it('Should append special markers on selection range', () => {
|
|
72
|
-
const editor = getJodit();
|
|
73
|
-
editor.value = '<p>t|es|t</p>';
|
|
74
|
-
setCursorToChar(editor);
|
|
75
|
-
simulateEvent('blur', editor);
|
|
76
|
-
|
|
77
|
-
expect(
|
|
78
|
-
editor.editor.querySelectorAll(
|
|
79
|
-
'span[data-jodit-selection_marker]'
|
|
80
|
-
).length
|
|
81
|
-
).eq(2);
|
|
82
|
-
|
|
83
|
-
expect(
|
|
84
|
-
sortAttributes(editor.getNativeEditorValue()).replace(
|
|
85
|
-
/[0-9]+_[0-9]+/g,
|
|
86
|
-
''
|
|
87
|
-
)
|
|
88
|
-
).eq(
|
|
89
|
-
'<p>t' +
|
|
90
|
-
'<span data-jodit-selection_marker="start" id="jodit-selection_marker_" style="display:none;line-height:0"></span>' +
|
|
91
|
-
'es' +
|
|
92
|
-
'<span data-jodit-selection_marker="end" id="jodit-selection_marker_" style="display:none;line-height:0"></span>' +
|
|
93
|
-
't</p>'
|
|
94
|
-
);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
describe('Disable', () => {
|
|
99
|
-
it('Should not append special markers on selection range', () => {
|
|
100
|
-
const editor = getJodit({
|
|
101
|
-
saveSelectionOnBlur: false
|
|
102
|
-
});
|
|
103
|
-
editor.value = '<p>t|es|t</p>';
|
|
104
|
-
setCursorToChar(editor);
|
|
105
|
-
simulateEvent('blur', editor);
|
|
106
|
-
|
|
107
|
-
expect(
|
|
108
|
-
editor.editor.querySelectorAll(
|
|
109
|
-
'span[data-jodit-selection_marker]'
|
|
110
|
-
).length
|
|
111
|
-
).eq(0);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
});
|
|
@@ -1,316 +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('Font test', function () {
|
|
7
|
-
describe('FontName', function () {
|
|
8
|
-
describe('Open fontname list and select some element', function () {
|
|
9
|
-
it('Should apply this font to current selection elements', function () {
|
|
10
|
-
const editor = getJodit({
|
|
11
|
-
toolbarAdaptive: false
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
editor.value = '<p>test</p>';
|
|
15
|
-
editor.s.select(editor.editor.firstChild.firstChild);
|
|
16
|
-
|
|
17
|
-
const openFontNameList = function () {
|
|
18
|
-
clickTrigger('font', editor);
|
|
19
|
-
|
|
20
|
-
const list = getOpenedPopup(editor);
|
|
21
|
-
|
|
22
|
-
return Array.from(list.querySelectorAll('button')).slice(1);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
expect(openFontNameList()).is.not.null;
|
|
26
|
-
|
|
27
|
-
Array.from(openFontNameList()).map(function (font) {
|
|
28
|
-
simulateEvent('click', 0, font);
|
|
29
|
-
|
|
30
|
-
const fontFamily = font
|
|
31
|
-
.querySelector('span[style]')
|
|
32
|
-
.getAttribute('style')
|
|
33
|
-
.replace(/"/g, "'");
|
|
34
|
-
|
|
35
|
-
expect(sortAttributes(editor.value)).equals(
|
|
36
|
-
sortAttributes(
|
|
37
|
-
'<p><span style="' +
|
|
38
|
-
fontFamily.replace('!important', '') +
|
|
39
|
-
'">test</span></p>'
|
|
40
|
-
)
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('Extends standard font list', function () {
|
|
46
|
-
it('Should standart font list elements', function () {
|
|
47
|
-
const editor = getJodit({
|
|
48
|
-
toolbarAdaptive: false,
|
|
49
|
-
controls: {
|
|
50
|
-
font: {
|
|
51
|
-
list: {
|
|
52
|
-
"-apple-system,BlinkMacSystemFont,'Segoe WPC','Segoe UI',HelveticaNeue-Light,Ubuntu,'Droid Sans',sans-serif":
|
|
53
|
-
'OS System Font'
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
editor.value = '<p>test</p>';
|
|
60
|
-
editor.s.select(editor.editor.firstChild.firstChild);
|
|
61
|
-
|
|
62
|
-
clickTrigger('font', editor);
|
|
63
|
-
|
|
64
|
-
const list = getOpenedPopup(editor);
|
|
65
|
-
|
|
66
|
-
expect(list).is.not.null;
|
|
67
|
-
|
|
68
|
-
const buttons = list.querySelectorAll('button'),
|
|
69
|
-
font = buttons[0];
|
|
70
|
-
|
|
71
|
-
simulateEvent('click', font);
|
|
72
|
-
|
|
73
|
-
expect(sortAttributes(editor.value)).equals(
|
|
74
|
-
sortAttributes(
|
|
75
|
-
"<p><span style=\"font-family:-apple-system,BlinkMacSystemFont,'Segoe WPC','Segoe UI',HelveticaNeue-Light,Ubuntu,'Droid Sans',sans-serif\">test</span></p>"
|
|
76
|
-
)
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('Change font-family and fomt-size in same time', function () {
|
|
84
|
-
it('should save font-size after font-family', function () {
|
|
85
|
-
const editor = getJodit();
|
|
86
|
-
|
|
87
|
-
clickTrigger('fontsize', editor);
|
|
88
|
-
const list = getOpenedPopup(editor);
|
|
89
|
-
|
|
90
|
-
clickButton('10', list);
|
|
91
|
-
editor.s.insertHTML('test');
|
|
92
|
-
|
|
93
|
-
expect(editor.value).equals(
|
|
94
|
-
'<p><span style="font-size: 10px;">test</span></p>'
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
clickTrigger('font', editor);
|
|
98
|
-
const list2 = getOpenedPopup(editor);
|
|
99
|
-
|
|
100
|
-
clickButton('Impact_Charcoal_sans_serif', list2);
|
|
101
|
-
editor.s.insertHTML('stop');
|
|
102
|
-
|
|
103
|
-
expect(sortAttributes(editor.value)).equals(
|
|
104
|
-
'<p><span style="font-size:10px">test' +
|
|
105
|
-
'<span style="font-family:Impact,Charcoal,sans-serif">stop</span></span></p>'
|
|
106
|
-
);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
['pt', 'px'].forEach(function (point) {
|
|
111
|
-
describe('Font size:' + point, function () {
|
|
112
|
-
describe('State', function () {
|
|
113
|
-
describe('First click on the button', function () {
|
|
114
|
-
it('Should open list', function () {
|
|
115
|
-
const editor = getJodit({
|
|
116
|
-
defaultFontSizePoints: point
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
clickButton('fontsize', editor);
|
|
120
|
-
|
|
121
|
-
const popup = getOpenedPopup(editor);
|
|
122
|
-
|
|
123
|
-
expect(popup).is.not.null;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
describe('Second click on the button', function () {
|
|
127
|
-
it('Should apply previous choice', function () {
|
|
128
|
-
const editor = getJodit({
|
|
129
|
-
defaultFontSizePoints: point
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
editor.value = 'text2text';
|
|
133
|
-
|
|
134
|
-
const range = editor.s.createRange(true);
|
|
135
|
-
|
|
136
|
-
range.setStart(
|
|
137
|
-
editor.editor.firstChild.firstChild,
|
|
138
|
-
3
|
|
139
|
-
);
|
|
140
|
-
range.setEnd(
|
|
141
|
-
editor.editor.firstChild.firstChild,
|
|
142
|
-
6
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
clickButton('fontsize', editor);
|
|
146
|
-
|
|
147
|
-
const popup = getOpenedPopup(editor);
|
|
148
|
-
|
|
149
|
-
expect(popup).is.not.null;
|
|
150
|
-
|
|
151
|
-
clickButton('8', popup);
|
|
152
|
-
|
|
153
|
-
expect(sortAttributes(editor.value)).equals(
|
|
154
|
-
'<p>tex<span style="font-size:8' +
|
|
155
|
-
point +
|
|
156
|
-
'">t2t</span>ext</p>'
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
const range2 = editor.s.createRange(true);
|
|
160
|
-
|
|
161
|
-
range2.setStartAfter(editor.editor.firstChild);
|
|
162
|
-
|
|
163
|
-
clickButton('fontsize', editor);
|
|
164
|
-
|
|
165
|
-
const popup2 = getOpenedPopup(editor);
|
|
166
|
-
|
|
167
|
-
expect(popup2).is.null;
|
|
168
|
-
|
|
169
|
-
expect(editor.value).equals(
|
|
170
|
-
'<p>tex<span style="font-size: 8' +
|
|
171
|
-
point +
|
|
172
|
-
';">t2t</span>ext</p><p><span style="font-size: 8' +
|
|
173
|
-
point +
|
|
174
|
-
';"></span></p>'
|
|
175
|
-
);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
describe('Font family', function () {
|
|
184
|
-
describe('State', function () {
|
|
185
|
-
describe('First click on the button', function () {
|
|
186
|
-
it('Should open list', function () {
|
|
187
|
-
const editor = getJodit();
|
|
188
|
-
|
|
189
|
-
clickButton('font', editor);
|
|
190
|
-
|
|
191
|
-
const popup = getOpenedPopup(editor);
|
|
192
|
-
|
|
193
|
-
expect(popup).is.not.null;
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
describe('Second click on the button', function () {
|
|
197
|
-
it('Should apply previous choice', function () {
|
|
198
|
-
const editor = getJodit();
|
|
199
|
-
|
|
200
|
-
editor.value = 'text2text';
|
|
201
|
-
|
|
202
|
-
const range = editor.s.createRange(true);
|
|
203
|
-
|
|
204
|
-
range.setStart(editor.editor.firstChild.firstChild, 3);
|
|
205
|
-
range.setEnd(editor.editor.firstChild.firstChild, 6);
|
|
206
|
-
|
|
207
|
-
clickButton('font', editor);
|
|
208
|
-
|
|
209
|
-
const popup = getOpenedPopup(editor);
|
|
210
|
-
|
|
211
|
-
expect(popup).is.not.null;
|
|
212
|
-
|
|
213
|
-
clickButton('Impact_Charcoal_sans_serif', popup);
|
|
214
|
-
|
|
215
|
-
expect(editor.value).equals(
|
|
216
|
-
'<p>tex<span style="font-family: Impact, Charcoal, sans-serif;">t2t</span>ext</p>'
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
const range2 = editor.s.createRange(true);
|
|
220
|
-
|
|
221
|
-
range2.setStartAfter(editor.editor.firstChild);
|
|
222
|
-
|
|
223
|
-
clickButton('font', editor);
|
|
224
|
-
|
|
225
|
-
const popup2 = getOpenedPopup(editor);
|
|
226
|
-
|
|
227
|
-
expect(popup2).is.null;
|
|
228
|
-
|
|
229
|
-
expect(editor.value).equals(
|
|
230
|
-
'<p>tex<span style="font-family: Impact, Charcoal, sans-serif;">t2t</span>ext</p><p><span style="font-family: Impact, Charcoal, sans-serif;"></span></p>'
|
|
231
|
-
);
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
describe('Active', function () {
|
|
239
|
-
describe('In list', function () {
|
|
240
|
-
describe('Fontsize button', function () {
|
|
241
|
-
it('Should be activated then element has some style value', function () {
|
|
242
|
-
const editor = getJodit({
|
|
243
|
-
observer: {
|
|
244
|
-
timeout: 0
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
editor.value =
|
|
249
|
-
'<p>test<span style="font-size: 12px">bold</span></p>';
|
|
250
|
-
editor.s.focus();
|
|
251
|
-
|
|
252
|
-
const p = editor.editor.firstChild;
|
|
253
|
-
const font = getButton('fontsize', editor);
|
|
254
|
-
|
|
255
|
-
expect(font).is.not.null;
|
|
256
|
-
|
|
257
|
-
editor.s.setCursorAfter(p.firstChild);
|
|
258
|
-
simulateEvent('mousedown', 0, p);
|
|
259
|
-
|
|
260
|
-
expect(font.getAttribute('aria-pressed')).equals('false');
|
|
261
|
-
|
|
262
|
-
editor.s.setCursorIn(p.lastChild);
|
|
263
|
-
|
|
264
|
-
simulateEvent('mousedown', 0, p);
|
|
265
|
-
|
|
266
|
-
clickTrigger('fontsize', editor);
|
|
267
|
-
|
|
268
|
-
const font12 = getOpenedPopup(editor).querySelector(
|
|
269
|
-
'[role="listitem"][class*="12"]'
|
|
270
|
-
);
|
|
271
|
-
|
|
272
|
-
expect(font12.getAttribute('aria-pressed')).equals('true');
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
describe('Font family button', function () {
|
|
277
|
-
it('Should be activated then element has some style value', function () {
|
|
278
|
-
const editor = getJodit({
|
|
279
|
-
toolbarAdaptive: false,
|
|
280
|
-
observer: {
|
|
281
|
-
timeout: 0
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
editor.value =
|
|
286
|
-
'<p>test<span style="font-family: Georgia, serif;">bold</span></p>';
|
|
287
|
-
editor.s.focus();
|
|
288
|
-
|
|
289
|
-
const p = editor.editor.firstChild;
|
|
290
|
-
const font = getButton('font', editor);
|
|
291
|
-
|
|
292
|
-
expect(font).is.not.null;
|
|
293
|
-
|
|
294
|
-
editor.s.setCursorAfter(p.firstChild);
|
|
295
|
-
simulateEvent('mousedown', 0, p);
|
|
296
|
-
expect(font.getAttribute('aria-pressed')).equals('false');
|
|
297
|
-
|
|
298
|
-
editor.s.setCursorIn(p.lastChild);
|
|
299
|
-
|
|
300
|
-
simulateEvent('mousedown', 0, p);
|
|
301
|
-
|
|
302
|
-
clickTrigger('font', editor);
|
|
303
|
-
|
|
304
|
-
const popup = getOpenedPopup(editor);
|
|
305
|
-
|
|
306
|
-
const fontGeorgia = popup.querySelector(
|
|
307
|
-
'[class*=Georgia_serif]'
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
expect(fontGeorgia).does.not.equal(font);
|
|
311
|
-
expect(fontGeorgia.hasAttribute('aria-pressed')).is.true;
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
});
|
|
@@ -1,79 +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('Process Images plugins', function () {
|
|
7
|
-
describe('Toolbar', function () {
|
|
8
|
-
describe('Click on Image button', function () {
|
|
9
|
-
it('Should open image dialog and insert image by url.', function () {
|
|
10
|
-
const editor = getJodit();
|
|
11
|
-
|
|
12
|
-
editor.value = Jodit.INVISIBLE_SPACE; // IE in iframe mode can loose focus and we can not check where it paste image in start or in finish. It is only in IE
|
|
13
|
-
|
|
14
|
-
const range = editor.s.createRange(true);
|
|
15
|
-
|
|
16
|
-
range.selectNodeContents(editor.editor);
|
|
17
|
-
range.collapse(false);
|
|
18
|
-
|
|
19
|
-
clickButton('image', editor);
|
|
20
|
-
|
|
21
|
-
const list = getOpenedPopup(editor);
|
|
22
|
-
|
|
23
|
-
expect(window.getComputedStyle(list).display).equals('block');
|
|
24
|
-
|
|
25
|
-
list.querySelector('input[name=url]').value = ''; // try wrong url
|
|
26
|
-
|
|
27
|
-
list.querySelector('input[name=text]').value = '123';
|
|
28
|
-
|
|
29
|
-
simulateEvent('submit', 0, list.querySelector('form'));
|
|
30
|
-
|
|
31
|
-
expect(
|
|
32
|
-
list.querySelectorAll('.jodit-ui-input_has-error_true')
|
|
33
|
-
.length
|
|
34
|
-
).equals(1);
|
|
35
|
-
|
|
36
|
-
list.querySelector('input[name=url]').value =
|
|
37
|
-
'http://xdsoft.net/jodit/images/artio.jpg';
|
|
38
|
-
|
|
39
|
-
simulateEvent('submit', 0, list.querySelector('form'));
|
|
40
|
-
|
|
41
|
-
expect(sortAttributes(editor.value)).equals(
|
|
42
|
-
'<p><img alt="123" src="http://xdsoft.net/jodit/images/artio.jpg" style="width:300px"></p>'
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
simulateEvent('mousedown', 0, editor.editor);
|
|
46
|
-
|
|
47
|
-
expect(list.parentNode).is.null;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe('When the cursor in the middle of some text', function () {
|
|
51
|
-
it('Should insert image in this position after submit', function () {
|
|
52
|
-
const editor = getJodit();
|
|
53
|
-
|
|
54
|
-
editor.value = 'hello world!';
|
|
55
|
-
|
|
56
|
-
const range = editor.s.createRange();
|
|
57
|
-
|
|
58
|
-
range.setEnd(editor.editor.firstChild.firstChild, 5);
|
|
59
|
-
range.collapse(false);
|
|
60
|
-
editor.s.selectRange(range);
|
|
61
|
-
|
|
62
|
-
clickButton('image', editor);
|
|
63
|
-
|
|
64
|
-
const list = getOpenedPopup(editor),
|
|
65
|
-
input = list.querySelector('input[name=url]');
|
|
66
|
-
|
|
67
|
-
input.focus();
|
|
68
|
-
input.value = 'http://xdsoft.net/jodit/images/artio.jpg';
|
|
69
|
-
|
|
70
|
-
simulateEvent('submit', 0, list.querySelector('form'));
|
|
71
|
-
|
|
72
|
-
expect(sortAttributes(editor.value)).equals(
|
|
73
|
-
'<p>hello<img alt="" src="http://xdsoft.net/jodit/images/artio.jpg" style="width:300px"> world!</p>'
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|