MOBILE-4470 iframes: Fix loading and improve responsive styles
parent
d2bb5c1b8f
commit
55428d5346
|
@ -876,7 +876,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncDirec
|
||||||
if (iframe.contentDocument) {
|
if (iframe.contentDocument) {
|
||||||
const css = document.createElement('style');
|
const css = document.createElement('style');
|
||||||
css.setAttribute('type', 'text/css');
|
css.setAttribute('type', 'text/css');
|
||||||
css.innerHTML = 'iframe {width: 100%;height: 100%;}';
|
css.innerHTML = 'iframe {width: 100%;height: 100%;position:absolute;top:0; left:0;}';
|
||||||
iframe.contentDocument.head.appendChild(css);
|
iframe.contentDocument.head.appendChild(css);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -344,7 +344,8 @@ export class CoreIframeUtilsProvider {
|
||||||
|
|
||||||
element.classList.add('core-loading');
|
element.classList.add('core-loading');
|
||||||
|
|
||||||
const treatElement = (sendResizeEvent: boolean = false) => {
|
const treatElement = (sendResizeEvent = false) => {
|
||||||
|
|
||||||
this.checkOnlineFrameInOffline(element, isSubframe);
|
this.checkOnlineFrameInOffline(element, isSubframe);
|
||||||
|
|
||||||
const { window, document } = this.getContentWindowAndDocument(element);
|
const { window, document } = this.getContentWindowAndDocument(element);
|
||||||
|
@ -361,10 +362,12 @@ export class CoreIframeUtilsProvider {
|
||||||
|
|
||||||
// Iframe content has been loaded.
|
// Iframe content has been loaded.
|
||||||
// Send a resize events to the iframe so it calculates the right size if needed.
|
// Send a resize events to the iframe so it calculates the right size if needed.
|
||||||
if (window && sendResizeEvent) {
|
if (sendResizeEvent) {
|
||||||
element.classList.remove('core-loading');
|
element.classList.remove('core-loading');
|
||||||
|
|
||||||
setTimeout(() => window.dispatchEvent && window.dispatchEvent(new Event('resize')), 1000);
|
if (window) {
|
||||||
|
setTimeout(() => window.dispatchEvent && window.dispatchEvent(new Event('resize')), 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue