Ghost/ghost/admin/app/components/gh-html-iframe.hbs
Kevin Ansfield 51efc0765d Improved rendering/re-rendering of <GhHtmlIframe>
no issue

There was noticeable flickering as content is loaded into the iframe or re-rendered because we show everything from the moment html is injected in, meaning the full loading and layout process is shown.

- changed to using two iframes with one being hidden
- when `@html` changes we inject the html into the hidden iframe
- once all loading finishes on the hidden iframe (or 500ms timeout occurs to account for slower connections) we swap the iframe visibility so we end up switching between two fully (mostly) rendered displays resulting in much less flicker
2021-10-13 12:21:53 +01:00

8 lines
337 B
Handlebars

<div
{{did-insert this.replaceIframeContents}}
{{did-update this.replaceIframeContents @html}}
...attributes
>
<iframe class="w-100 h-100" {{did-insert this.registerIframe}} {{on "load" this.didLoad}}></iframe>
<iframe class="w-100 h-100" {{did-insert this.registerIframe}} {{on "load" this.didLoad}}></iframe>
</div>