Commit Graph

5 Commits

Author SHA1 Message Date
Kevin Ansfield
f66c992ad8 Fixed design preview remembering scroll position when changing page
refs https://github.com/TryGhost/Team/issues/1149

- added a `@pageId` argument to `<GhHtmlIframe>`, if that value is different at the point of swapping iframes after re-rendering it will reset the scroll position instead of copying it from the to-be-hidden iframe
- assigned `themeManagement.previewType` to `@pageId` so that it changes when switching between homepage and post previews
2021-10-21 13:37:38 +01:00
Kevin Ansfield
977e4d55f4 Fixed design settings preview losing scroll position when changing settings
refs https://github.com/TryGhost/Team/issues/1149

- replicated the visible iframe's `scrollTop` to the hidden iframe before swapping visibility between them so the scroll position remains consistent even though the contents and frames are fully reloaded and swapped
2021-10-19 13:52:47 +01:00
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
Kevin Ansfield
1d0cd80158 Added basic reset to design preview on nav bar interaction
refs https://github.com/TryGhost/Team/issues/1130

- when opening/closing sections or interacting with the general design or custom theme settings we want to switch back to showing the preview so the sidebar acts more like typical navigation and so form changes show their effect
2021-10-11 21:09:42 +01:00
Kevin Ansfield
221db9f11e Fixed design preview and settings not updating when changing theme
refs https://github.com/TryGhost/Team/issues/1111

We now have a situation where we have modals on modals and we've lost the straightforward built-in "Data down, actions up" communication methods that we'd have workaround across nested routes/controllers. The upshot of that is we didn't have a way to trigger a refresh of the preview when a new theme was activated.

- moved the task responsible for fetching preview html from the design modal onto the `theme-management` service and adjusted it to set a tracked `previewHtml` property rather than updating an iframe directly
- added a `<GhHtmlIframe>` component that renders a basic iframe element and updates it's contents each time the `@html` argument changes
- updated design modal preview to use the new iframe component
2021-10-05 21:32:42 +01:00