forked from dachcom-digital/pimcore-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.js
58 lines (42 loc) · 1.56 KB
/
edit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
pimcore.registerNS('pimcore.document.edit');
pimcore.document.edit = Class.create(pimcore.document.edit, {
/**
* Because pimocore does a sloppy job in this method, we need to override it:
* maskFrames will trigger to early => all iframe masks will have a wrong position!
*/
maskFrames: function () {
var _ = this, i, iFrames, iframe;
try {
if (typeof _.frame.Ext !== 'object') {
return;
}
iFrames = _.frame.document.getElementsByTagName('iframe');
for (i = 0; i < iFrames.length; i++) {
iframe = iFrames[i];
iframe.onload = function() {
var $frame = Ext.get(this),
$parentElement = $frame.parent(),
$element, width, height;
width = $frame.getWidth();
height = $frame.getHeight();
$parentElement.applyStyles({
position: 'relative'
});
$element = $parentElement.createChild({
tag: 'div',
id: Ext.id()
});
$element.setStyle({
width: width + 'px',
height: height + 'px',
left: 0,
top: 0
});
$element.addCls('pimcore_iframe_mask');
};
}
} catch (e) {
console.log(e);
}
}
});