mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05: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
2 changed files with 14 additions and 4 deletions
|
@ -18,7 +18,13 @@ export default class GhSiteIframeComponent extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
get srcUrl() {
|
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
|
@action
|
||||||
|
@ -43,10 +49,13 @@ export default class GhSiteIframeComponent extends Component {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
onLoad(event) {
|
onLoad(event) {
|
||||||
|
this.iframe = event.target;
|
||||||
|
|
||||||
if (this.args.invisibleUntilLoaded && typeof this.args.invisibleUntilLoaded === 'boolean') {
|
if (this.args.invisibleUntilLoaded && typeof this.args.invisibleUntilLoaded === 'boolean') {
|
||||||
this.makeVisible.perform();
|
this.makeVisible.perform();
|
||||||
|
} else {
|
||||||
|
this.args.onLoad?.(this.iframe);
|
||||||
}
|
}
|
||||||
this.args.onLoad?.(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
@ -73,5 +82,6 @@ export default class GhSiteIframeComponent extends Component {
|
||||||
// allows portal to render it's overlay and prevent site background flashes
|
// allows portal to render it's overlay and prevent site background flashes
|
||||||
yield timeout(100);
|
yield timeout(100);
|
||||||
this.isInvisible = false;
|
this.isInvisible = false;
|
||||||
|
this.args.onLoad?.(this.iframe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,8 @@ export default class MembersAccessController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
portalPreviewLoaded(event) {
|
portalPreviewLoaded(iframe) {
|
||||||
this.portalPreviewIframe = event.target;
|
this.portalPreviewIframe = iframe;
|
||||||
this.resizePortalPreviewTask.perform();
|
this.resizePortalPreviewTask.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue