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,211 +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 popup', function () {
|
|
7
|
-
const position = Jodit.modules.Helpers.position;
|
|
8
|
-
|
|
9
|
-
let textBox;
|
|
10
|
-
const elms = [];
|
|
11
|
-
|
|
12
|
-
beforeEach(function () {
|
|
13
|
-
textBox = document.createElement('div');
|
|
14
|
-
Object.assign(textBox.style, {
|
|
15
|
-
position: 'fixed',
|
|
16
|
-
display: 'flex',
|
|
17
|
-
flexWrap: 'wrap',
|
|
18
|
-
top: 0,
|
|
19
|
-
left: 0,
|
|
20
|
-
width: '100%',
|
|
21
|
-
height: '100%',
|
|
22
|
-
background: 'red'
|
|
23
|
-
});
|
|
24
|
-
document.body.appendChild(textBox);
|
|
25
|
-
|
|
26
|
-
for (let i = 0; i < 4; i += 1) {
|
|
27
|
-
for (let j = 0; j < 4; j += 1) {
|
|
28
|
-
const elmBox = document.createElement('div');
|
|
29
|
-
|
|
30
|
-
Object.assign(elmBox.style, {
|
|
31
|
-
width: '25%',
|
|
32
|
-
height: '25%',
|
|
33
|
-
background:
|
|
34
|
-
'rgb(' +
|
|
35
|
-
(i * 30 + 128) +
|
|
36
|
-
',' +
|
|
37
|
-
(j * 30 + 28) +
|
|
38
|
-
', ' +
|
|
39
|
-
(i * 10 + j * 10 + 100) +
|
|
40
|
-
')'
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
textBox.appendChild(elmBox);
|
|
44
|
-
elms.push(elmBox);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
afterEach(function () {
|
|
50
|
-
textBox && textBox.remove();
|
|
51
|
-
elms.length = 0;
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const aliases = {
|
|
55
|
-
leftTop: function () {
|
|
56
|
-
return elms[0];
|
|
57
|
-
},
|
|
58
|
-
rightTop: function () {
|
|
59
|
-
return elms[3];
|
|
60
|
-
},
|
|
61
|
-
leftBottom: function () {
|
|
62
|
-
return elms[12];
|
|
63
|
-
},
|
|
64
|
-
rightBottom: function () {
|
|
65
|
-
return elms[15];
|
|
66
|
-
},
|
|
67
|
-
center: function () {
|
|
68
|
-
return elms[5];
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const openPopup = function (getBound, content, strategy) {
|
|
73
|
-
const editor = getJodit();
|
|
74
|
-
|
|
75
|
-
const popup = new Jodit.modules.Popup(editor);
|
|
76
|
-
|
|
77
|
-
if (strategy) {
|
|
78
|
-
popup.strategy = strategy;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
popup.setContent(content || 'Test content').open(getBound);
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
left: parseInt(popup.container.style.left, 10),
|
|
85
|
-
top: parseInt(popup.container.style.top, 10),
|
|
86
|
-
width: popup.container.offsetWidth,
|
|
87
|
-
height: popup.container.offsetHeight
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
describe('Open popup on some target', function () {
|
|
92
|
-
describe('Usual case - there is enough space under element', function () {
|
|
93
|
-
it('should show popup under element', function () {
|
|
94
|
-
const div = appendTestDiv();
|
|
95
|
-
div.innerText = 'test';
|
|
96
|
-
|
|
97
|
-
const gb = function () {
|
|
98
|
-
return position(div);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const pos = openPopup(gb);
|
|
102
|
-
|
|
103
|
-
expect(pos.left).equals(gb().left);
|
|
104
|
-
expect(pos.top).equals(gb().top + gb().height);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
describe('Corners', function () {
|
|
109
|
-
describe('Change default strategy', function () {
|
|
110
|
-
it('should show popup to match the strategy', function () {
|
|
111
|
-
const gb = function () {
|
|
112
|
-
return position(aliases.center());
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const pos = openPopup(gb, false, 'rightBottom');
|
|
116
|
-
|
|
117
|
-
expect(pos.left + pos.width).equals(gb().left + gb().width);
|
|
118
|
-
expect(pos.top).equals(gb().top + gb().height);
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
describe('Left-Top', function () {
|
|
123
|
-
it('should show popup under element', function () {
|
|
124
|
-
const gb = function () {
|
|
125
|
-
return position(aliases.leftTop());
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const pos = openPopup(gb);
|
|
129
|
-
|
|
130
|
-
expect(pos.left).equals(gb().left);
|
|
131
|
-
expect(pos.top).equals(gb().top + gb().height);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe('Right-Top', function () {
|
|
136
|
-
describe('Small popup', function () {
|
|
137
|
-
it('should show popup under element', function () {
|
|
138
|
-
const gb = function () {
|
|
139
|
-
return position(aliases.rightTop());
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const pos = openPopup(gb);
|
|
143
|
-
|
|
144
|
-
expect(pos.left).equals(gb().left);
|
|
145
|
-
expect(pos.top).equals(gb().top + gb().height);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
describe('Big popup', function () {
|
|
150
|
-
it("should show popup under element but right corner should be under target's right-bottom corner", function () {
|
|
151
|
-
const gb = function () {
|
|
152
|
-
return position(aliases.rightTop());
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const pos = openPopup(gb, 'testO'.repeat(30));
|
|
156
|
-
|
|
157
|
-
expect(pos.left + pos.width).equals(
|
|
158
|
-
gb().left + gb().width
|
|
159
|
-
);
|
|
160
|
-
expect(pos.top).equals(gb().top + gb().height);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
describe('Left-Bottom', function () {
|
|
166
|
-
describe('Small popup', function () {
|
|
167
|
-
it('should show popup above element', function () {
|
|
168
|
-
const gb = function () {
|
|
169
|
-
return position(aliases.leftBottom());
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const pos = openPopup(gb);
|
|
173
|
-
|
|
174
|
-
expect(pos.left).equals(gb().left);
|
|
175
|
-
expect(pos.top + pos.height).equals(gb().top);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
describe('Right-Bottom', function () {
|
|
181
|
-
describe('Small popup', function () {
|
|
182
|
-
it('should show popup above element', function () {
|
|
183
|
-
const gb = function () {
|
|
184
|
-
return position(aliases.rightBottom());
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const pos = openPopup(gb);
|
|
188
|
-
|
|
189
|
-
expect(pos.left).equals(gb().left);
|
|
190
|
-
expect(pos.top + pos.height).equals(gb().top);
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
describe('Big popup', function () {
|
|
195
|
-
it("should show popup above the element but right corner should be above target's right-top corner", function () {
|
|
196
|
-
const gb = function () {
|
|
197
|
-
return position(aliases.rightBottom());
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const pos = openPopup(gb, 'testO'.repeat(30));
|
|
201
|
-
|
|
202
|
-
expect(pos.left + pos.width).equals(
|
|
203
|
-
gb().left + gb().width
|
|
204
|
-
);
|
|
205
|
-
expect(pos.top + pos.height).equals(gb().top);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
});
|
|
@@ -1,238 +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 position/offset helpers', function () {
|
|
7
|
-
let box,
|
|
8
|
-
mainBox = getBox(),
|
|
9
|
-
iframe = document.createElement('iframe');
|
|
10
|
-
|
|
11
|
-
iframe.setAttribute(
|
|
12
|
-
'style',
|
|
13
|
-
'position: absolute; left: 0; top: 0; border: 0; width: 2000px; height: 3000px; background: purple; z-index: 1000000;'
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
let mainDoc;
|
|
17
|
-
|
|
18
|
-
beforeEach(function () {
|
|
19
|
-
mainBox.appendChild(iframe);
|
|
20
|
-
mainDoc = iframe.contentWindow.document;
|
|
21
|
-
|
|
22
|
-
const lines = [];
|
|
23
|
-
|
|
24
|
-
Jodit.modules.Helpers.$$('style, link', document).forEach(function (
|
|
25
|
-
elm
|
|
26
|
-
) {
|
|
27
|
-
const t = elm.tagName.toLowerCase();
|
|
28
|
-
|
|
29
|
-
let content;
|
|
30
|
-
|
|
31
|
-
if (t === 'link' && elm.sheet) {
|
|
32
|
-
content = Array.from(elm.sheet.cssRules)
|
|
33
|
-
.map(function (f) {
|
|
34
|
-
return f.cssText;
|
|
35
|
-
})
|
|
36
|
-
.join('\n');
|
|
37
|
-
} else {
|
|
38
|
-
content = elm.innerHTML;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
lines.push('<style>' + content + '</style>');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
mainDoc.open();
|
|
45
|
-
mainDoc.write(
|
|
46
|
-
'<html><head>' +
|
|
47
|
-
lines.join('') +
|
|
48
|
-
'<style>textarea {display: none}strong {height:18px;display:block}</style></head><body><div></div><textarea></textarea></body></html>'
|
|
49
|
-
);
|
|
50
|
-
mainDoc.close();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
function makeBox(doc) {
|
|
54
|
-
doc = doc || mainDoc;
|
|
55
|
-
const win = doc.defaultView;
|
|
56
|
-
|
|
57
|
-
box = doc.createElement('div');
|
|
58
|
-
box.id = 'uniq';
|
|
59
|
-
box.setAttribute(
|
|
60
|
-
'style',
|
|
61
|
-
'height: 2000px; width: 100%;border: 20px solid red; padding: 20px; margin: 20px;'
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const style = doc.createElement('style');
|
|
65
|
-
style.innerHTML =
|
|
66
|
-
'html, body {height: 5000px; width: 5000px;} #uniq, #uniq strong, #uniq div {line-height:18px;font-family: Arial;box-sizing:content-box; } #uniq strong {height:18px;display:block}';
|
|
67
|
-
box.appendChild(style);
|
|
68
|
-
|
|
69
|
-
doc.body.appendChild(box);
|
|
70
|
-
win.scrollTo(0, box.offsetTop);
|
|
71
|
-
|
|
72
|
-
const div = doc.createElement('div');
|
|
73
|
-
|
|
74
|
-
for (let i = 0; i < 30; i += 1) {
|
|
75
|
-
const s = doc.createElement('strong');
|
|
76
|
-
// s.textContent = i;
|
|
77
|
-
div.appendChild(s);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
box.appendChild(div);
|
|
81
|
-
div.setAttribute(
|
|
82
|
-
'style',
|
|
83
|
-
'position: relative; height: 300px; width: 100%;border: 20px solid red; padding: 20px 0 0 20px; margin: 20px 0 0 20px; overflow: hidden;'
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const div2 = doc.createElement('div');
|
|
87
|
-
div.appendChild(div2);
|
|
88
|
-
div2.setAttribute(
|
|
89
|
-
'style',
|
|
90
|
-
'position: relative; min-height: 200px; width: 100%;border: 10px solid yellow; padding: 20px 0 0 20px; margin: 20px 0 0 20px;'
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const div3 = doc.createElement('div');
|
|
94
|
-
div2.appendChild(div3);
|
|
95
|
-
div3.setAttribute(
|
|
96
|
-
'style',
|
|
97
|
-
'position: relative; min-height: 200px; width: 100%;border: 10px solid green; padding: 20px 0 0 20px; margin: 20px 0 0 20px;'
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const div6 = doc.createElement('div');
|
|
101
|
-
div3.appendChild(doc.createElement('strong'));
|
|
102
|
-
div3.appendChild(doc.createElement('strong'));
|
|
103
|
-
div3.appendChild(doc.createElement('strong'));
|
|
104
|
-
div3.appendChild(div6);
|
|
105
|
-
div6.setAttribute(
|
|
106
|
-
'style',
|
|
107
|
-
'width: 100%;border: 10px solid blue; padding: 20px 0 0 20px; margin: 20px 0 0 20px;'
|
|
108
|
-
);
|
|
109
|
-
div6.innerHTML = 'hi';
|
|
110
|
-
|
|
111
|
-
div.scrollTo(0, 100000);
|
|
112
|
-
|
|
113
|
-
return div6;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function fillBox(count, box) {
|
|
117
|
-
for (let i = 0; i < count; i += 1) {
|
|
118
|
-
const br = mainDoc.createElement('strong');
|
|
119
|
-
box.appendChild(br);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
describe('Test position helper', function () {
|
|
124
|
-
it('Should calculate correct screen position of element', function () {
|
|
125
|
-
const span = makeBox();
|
|
126
|
-
|
|
127
|
-
const pos = Jodit.modules.Helpers.position(span);
|
|
128
|
-
|
|
129
|
-
createPoint(pos.left, pos.top, '#cdf', true);
|
|
130
|
-
|
|
131
|
-
expect(pos.top).equals(254);
|
|
132
|
-
expect(pos.left).equals(240);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe('In the out of the screen', function () {
|
|
136
|
-
it('Should show negative screen coordinates', function () {
|
|
137
|
-
const span = makeBox();
|
|
138
|
-
|
|
139
|
-
iframe.contentWindow.scrollTo(0, box.offsetTop + 1500);
|
|
140
|
-
const pos = Jodit.modules.Helpers.position(span);
|
|
141
|
-
|
|
142
|
-
createPoint(pos.left, pos.top, '#cdf', true);
|
|
143
|
-
|
|
144
|
-
expect(pos.top).equals(-1246);
|
|
145
|
-
expect(pos.left).equals(240);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
describe('In iframe', function () {
|
|
150
|
-
it('Should calculate correct screen position of element', function () {
|
|
151
|
-
fillBox(100, mainDoc.querySelector('div'));
|
|
152
|
-
|
|
153
|
-
const jodit = Jodit.make('textarea', {
|
|
154
|
-
ownerWindow: iframe.contentWindow,
|
|
155
|
-
ownerDocument: mainDoc,
|
|
156
|
-
iframe: true,
|
|
157
|
-
height: 10000
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
const span = makeBox(jodit.ed);
|
|
161
|
-
|
|
162
|
-
jodit.ownerWindow.scrollTo(0, jodit.container.offsetTop - 100);
|
|
163
|
-
|
|
164
|
-
const pos = Jodit.modules.Helpers.position(span, jodit);
|
|
165
|
-
|
|
166
|
-
createPoint(pos.left, pos.top, '#cdf', true);
|
|
167
|
-
|
|
168
|
-
expect(pos.top - jodit.toolbar.container.offsetHeight).equals(
|
|
169
|
-
386
|
|
170
|
-
);
|
|
171
|
-
expect(pos.left).equals(251);
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
describe('Test offset helper', function () {
|
|
177
|
-
it('Should calculate correct absolute position of element from top of document', function () {
|
|
178
|
-
const span = makeBox(),
|
|
179
|
-
jodit = Jodit.make('textarea', {
|
|
180
|
-
ownerWindow: iframe.contentWindow,
|
|
181
|
-
ownerDocument: mainDoc
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
jodit.editor.appendChild(box);
|
|
185
|
-
box.firstChild.scrollTo(0, 100000);
|
|
186
|
-
|
|
187
|
-
iframe.contentWindow.scrollTo(0, jodit.container.offsetTop);
|
|
188
|
-
jodit.editor.scrollTo(0, span.offsetTop);
|
|
189
|
-
|
|
190
|
-
const pos = Jodit.modules.Helpers.offset(span, jodit, jodit.ed);
|
|
191
|
-
|
|
192
|
-
createPoint(pos.left, pos.top, '#cdf');
|
|
193
|
-
|
|
194
|
-
expect(
|
|
195
|
-
pos.top -
|
|
196
|
-
box.offsetTop -
|
|
197
|
-
iframe.contentWindow.scrollY -
|
|
198
|
-
jodit.toolbar.container.offsetHeight
|
|
199
|
-
).equals(816);
|
|
200
|
-
expect(pos.left).equals(249);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
describe('In iframe', function () {
|
|
204
|
-
it('Should calculate correct absolute position of element from top of document', function () {
|
|
205
|
-
const jodit = Jodit.make('textarea', {
|
|
206
|
-
ownerWindow: iframe.contentWindow,
|
|
207
|
-
ownerDocument: mainDoc,
|
|
208
|
-
iframe: true,
|
|
209
|
-
height: 10000
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
const span = makeBox(jodit.ed);
|
|
213
|
-
box.firstChild.scrollTo(0, 100000);
|
|
214
|
-
|
|
215
|
-
iframe.contentWindow.scrollTo(0, jodit.container.offsetTop);
|
|
216
|
-
jodit.editor.scrollTo(0, span.offsetTop);
|
|
217
|
-
|
|
218
|
-
const pos = Jodit.modules.Helpers.offset(span, jodit, jodit.ed);
|
|
219
|
-
|
|
220
|
-
expect(
|
|
221
|
-
pos.top -
|
|
222
|
-
box.offsetTop -
|
|
223
|
-
jodit.ownerWindow.scrollY -
|
|
224
|
-
jodit.ew.scrollY -
|
|
225
|
-
jodit.toolbar.container.offsetHeight
|
|
226
|
-
).equals(256);
|
|
227
|
-
expect(pos.left).equals(251);
|
|
228
|
-
|
|
229
|
-
createPoint(pos.left, pos.top, '#cdf');
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
afterEach(function () {
|
|
235
|
-
Jodit.modules.Dom.safeRemove(box);
|
|
236
|
-
Jodit.modules.Dom.safeRemove(iframe);
|
|
237
|
-
});
|
|
238
|
-
});
|