mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-07 02:23:23 +00:00
ext6migrate: update Ext.ux.IFrame code in Toolkit.js
update to current code from framework makes it working again Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
16b8d964cd
commit
06366d355b
@ -122,22 +122,14 @@ Ext.define('Ext.ux.IFrame', {
|
|||||||
src: 'about:blank',
|
src: 'about:blank',
|
||||||
|
|
||||||
renderTpl: [
|
renderTpl: [
|
||||||
'<iframe src="{src}" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
|
'<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
|
||||||
],
|
],
|
||||||
|
childEls: ['iframeEl'],
|
||||||
|
|
||||||
initComponent: function () {
|
initComponent: function () {
|
||||||
this.callParent();
|
this.callParent();
|
||||||
|
|
||||||
this.frameName = this.frameName || this.id + '-frame';
|
this.frameName = this.frameName || this.id + '-frame';
|
||||||
|
|
||||||
this.addEvents(
|
|
||||||
'beforeload',
|
|
||||||
'load'
|
|
||||||
);
|
|
||||||
|
|
||||||
Ext.apply(this.renderSelectors, {
|
|
||||||
iframeEl: 'iframe'
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initEvents : function() {
|
initEvents : function() {
|
||||||
@ -190,9 +182,9 @@ Ext.define('Ext.ux.IFrame', {
|
|||||||
|
|
||||||
if (this.rendered) {
|
if (this.rendered) {
|
||||||
try {
|
try {
|
||||||
doc = this.getDoc();
|
doc = this.getDoc();
|
||||||
if (doc) {
|
if (doc) {
|
||||||
Ext.EventManager.removeAll(doc);
|
Ext.get(doc).un(this._docListeners);
|
||||||
if (destroying) {
|
if (destroying) {
|
||||||
for (prop in doc) {
|
for (prop in doc) {
|
||||||
if (doc.hasOwnProperty && doc.hasOwnProperty(prop)) {
|
if (doc.hasOwnProperty && doc.hasOwnProperty(prop)) {
|
||||||
@ -212,32 +204,32 @@ Ext.define('Ext.ux.IFrame', {
|
|||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
try {
|
try {
|
||||||
Ext.EventManager.removeAll(doc);
|
|
||||||
|
|
||||||
// These events need to be relayed from the inner document (where they stop
|
// These events need to be relayed from the inner document (where they stop
|
||||||
// bubbling) up to the outer document. This has to be done at the DOM level so
|
// bubbling) up to the outer document. This has to be done at the DOM level so
|
||||||
// the event reaches listeners on elements like the document body. The effected
|
// the event reaches listeners on elements like the document body. The effected
|
||||||
// mechanisms that depend on this bubbling behavior are listed to the right
|
// mechanisms that depend on this bubbling behavior are listed to the right
|
||||||
// of the event.
|
// of the event.
|
||||||
Ext.EventManager.on(doc, {
|
Ext.get(doc).on(
|
||||||
mousedown: fn, // menu dismisal (MenuManager) and Window onMouseDown (toFront)
|
me._docListeners = {
|
||||||
mousemove: fn, // window resize drag detection
|
mousedown: fn, // menu dismisal (MenuManager) and Window onMouseDown (toFront)
|
||||||
mouseup: fn, // window resize termination
|
mousemove: fn, // window resize drag detection
|
||||||
click: fn, // not sure, but just to be safe
|
mouseup: fn, // window resize termination
|
||||||
dblclick: fn, // not sure again
|
click: fn, // not sure, but just to be safe
|
||||||
scope: me
|
dblclick: fn, // not sure again
|
||||||
});
|
scope: me
|
||||||
|
}
|
||||||
|
);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// cannot do this xss
|
// cannot do this xss
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to be sure we remove all our events from the iframe on unload or we're going to LEAK!
|
// We need to be sure we remove all our events from the iframe on unload or we're going to LEAK!
|
||||||
Ext.EventManager.on(this.getWin(), 'beforeunload', me.cleanupListeners, me);
|
Ext.get(this.getWin()).on('beforeunload', me.cleanupListeners, me);
|
||||||
|
|
||||||
this.el.unmask();
|
this.el.unmask();
|
||||||
this.fireEvent('load', this);
|
this.fireEvent('load', this);
|
||||||
|
|
||||||
} else if(me.src && me.src != '') {
|
} else if (me.src) {
|
||||||
|
|
||||||
this.el.unmask();
|
this.el.unmask();
|
||||||
this.fireEvent('error', this);
|
this.fireEvent('error', this);
|
||||||
@ -246,6 +238,29 @@ Ext.define('Ext.ux.IFrame', {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRelayedEvent: function (event) {
|
||||||
|
// relay event from the iframe's document to the document that owns the iframe...
|
||||||
|
|
||||||
|
var iframeEl = this.iframeEl,
|
||||||
|
|
||||||
|
// Get the left-based iframe position
|
||||||
|
iframeXY = iframeEl.getTrueXY(),
|
||||||
|
originalEventXY = event.getXY(),
|
||||||
|
|
||||||
|
// Get the left-based XY position.
|
||||||
|
// This is because the consumer of the injected event will
|
||||||
|
// perform its own RTL normalization.
|
||||||
|
eventXY = event.getTrueXY();
|
||||||
|
|
||||||
|
// the event from the inner document has XY relative to that document's origin,
|
||||||
|
// so adjust it to use the origin of the iframe in the outer document:
|
||||||
|
event.xy = [iframeXY[0] + eventXY[0], iframeXY[1] + eventXY[1]];
|
||||||
|
|
||||||
|
event.injectEvent(iframeEl); // blame the iframe for the event...
|
||||||
|
|
||||||
|
event.xy = originalEventXY; // restore the original XY (just for safety)
|
||||||
|
},
|
||||||
|
|
||||||
load: function (src) {
|
load: function (src) {
|
||||||
var me = this,
|
var me = this,
|
||||||
text = me.loadMask,
|
text = me.loadMask,
|
||||||
|
Loading…
Reference in New Issue
Block a user