mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Fixed flash of site when portal preview is loading
no issue - added `@invisibleUntilLoaded` boolean argument to `<GhSiteIframe>` - when set to true add `.invisible` class until iframe's `load` event is triggered - removed manual iframe hiding with 1.2sec delay from portal settings modal - added `@onLoad` argument to `<GhSiteIframe>` for consumers to hook in if needed
This commit is contained in:
parent
b4a6eb594d
commit
602549097a
@ -1,8 +1,9 @@
|
||||
<iframe
|
||||
class="site-frame"
|
||||
class="site-frame {{if this.isInvisible "invisible"}}"
|
||||
src={{this.srcUrl}}
|
||||
frameborder="0"
|
||||
allowtransparency="true"
|
||||
{{did-update this.resetSrcAttribute @guid}}
|
||||
{{on "load" this.onLoad}}
|
||||
...attributes
|
||||
></iframe>
|
@ -1,10 +1,13 @@
|
||||
import Component from '@glimmer/component';
|
||||
import {action} from '@ember/object';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {tracked} from '@glimmer/tracking';
|
||||
|
||||
export default class GhSiteIframeComponent extends Component {
|
||||
@service config;
|
||||
|
||||
@tracked isInvisible = this.args.invisibleUntilLoaded;
|
||||
|
||||
get srcUrl() {
|
||||
return this.args.src || `${this.config.get('blogUrl')}/`;
|
||||
}
|
||||
@ -20,4 +23,12 @@ export default class GhSiteIframeComponent extends Component {
|
||||
}
|
||||
this._lastGuid = this.args.guid;
|
||||
}
|
||||
|
||||
@action
|
||||
onLoad(event) {
|
||||
if (this.args.invisibleUntilLoaded) {
|
||||
this.isInvisible = false;
|
||||
}
|
||||
this.args.onLoad?.(event);
|
||||
}
|
||||
}
|
||||
|
@ -242,8 +242,9 @@
|
||||
<div class="gh-portal-preview-container {{if this.showLinksPage "hide"}}">
|
||||
<div class="gh-portal-site-frame-cover"> </div>
|
||||
<GhSiteIframe
|
||||
class="gh-portal-siteiframe"
|
||||
@src={{this.portalPreviewUrl}}
|
||||
class="gh-portal-siteiframe {{if this.hidePreviewFrame "invisible"}}" />
|
||||
@invisibleUntilLoaded={{true}} />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -88,7 +88,6 @@ export default ModalComponent.extend({
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set('hidePreviewFrame', true);
|
||||
this.buttonStyleOptions = [
|
||||
{name: 'icon-and-text', label: 'Icon and text'},
|
||||
{name: 'icon-only', label: 'Icon only'},
|
||||
@ -108,11 +107,6 @@ export default ModalComponent.extend({
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
this.settings.get('errors').clear();
|
||||
run.later(this, function () {
|
||||
if (!this.isDestroyed && !this.isDestroying) {
|
||||
this.set('hidePreviewFrame', false);
|
||||
}
|
||||
}, 1200);
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
@ -51,7 +51,9 @@
|
||||
{{#if (eq this.settings.membersSignupAccess 'none')}}
|
||||
PORTAL DISABLED
|
||||
{{else}}
|
||||
<GhSiteIframe @src={{this.portalPreviewUrl}} />
|
||||
<GhSiteIframe
|
||||
@src={{this.portalPreviewUrl}}
|
||||
@invisibleUntilLoaded={{true}} />
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user