mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Fixed portal preview resize and cached page bugs
no issue - moved `@onLoad` trigger from `load` event to the `makeVisible()` task so that consumer code isn't called before load has fully finished - fixes issue with portal sometimes not being ready when we perform the resize on the membership screen - added guid as a cache-busting `?v={guid}` query param - fixes issue where preview iframe can load stale data after a settings change resulting in a blank preview after going from "nobody" to "invite/anybody" because the loaded homepage is stale and doesn't have the portal script injected
This commit is contained in:
parent
757f061362
commit
baafe011a2
@ -18,7 +18,13 @@ export default class GhSiteIframeComponent extends Component {
|
||||
}
|
||||
|
||||
get srcUrl() {
|
||||
return this.args.src || `${this.config.get('blogUrl')}/`;
|
||||
const srcUrl = new URL(this.args.src || `${this.config.get('blogUrl')}/`);
|
||||
|
||||
if (this.args.guid) {
|
||||
srcUrl.searchParams.set('v', this.args.guid);
|
||||
}
|
||||
|
||||
return srcUrl.href;
|
||||
}
|
||||
|
||||
@action
|
||||
@ -43,10 +49,13 @@ export default class GhSiteIframeComponent extends Component {
|
||||
|
||||
@action
|
||||
onLoad(event) {
|
||||
this.iframe = event.target;
|
||||
|
||||
if (this.args.invisibleUntilLoaded && typeof this.args.invisibleUntilLoaded === 'boolean') {
|
||||
this.makeVisible.perform();
|
||||
} else {
|
||||
this.args.onLoad?.(this.iframe);
|
||||
}
|
||||
this.args.onLoad?.(event);
|
||||
}
|
||||
|
||||
@action
|
||||
@ -73,5 +82,6 @@ export default class GhSiteIframeComponent extends Component {
|
||||
// allows portal to render it's overlay and prevent site background flashes
|
||||
yield timeout(100);
|
||||
this.isInvisible = false;
|
||||
this.args.onLoad?.(this.iframe);
|
||||
}
|
||||
}
|
||||
|
@ -239,8 +239,8 @@ export default class MembersAccessController extends Controller {
|
||||
}
|
||||
|
||||
@action
|
||||
portalPreviewLoaded(event) {
|
||||
this.portalPreviewIframe = event.target;
|
||||
portalPreviewLoaded(iframe) {
|
||||
this.portalPreviewIframe = iframe;
|
||||
this.resizePortalPreviewTask.perform();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user