Gutenberg: Improve flow for previewing unsaved pages/posts

Created on 20 Oct 2017  ·  3Comments  ·  Source: WordPress/gutenberg

Issue Overview

If you load the demo content and press Preview before the content has saved, you get an empty new tab on the URL about:blank, which sits there for a few seconds, and then it redirects you to the preview.

What happens in the background is that as soon as you press preview, we actually do save the content, but we also open the browser tab where the preview will eventually load.

The wait period is a bit jarring, though:

preview

It would be nice if instead of loading about:blank, we could load something else, an intermediate page that says "Preparing your preview" or something. Doesn't have to be complex, can be a completely white page with the text centered.

[Type] Enhancement

Most helpful comment

I've started work on this, will try and make a PR tomorrow.

All 3 comments

A bit of technical context:

Popup windows can only be opened in response to user interaction. Therefore, we must open the popup as soon as the user clicks Preview, otherwise we won't be permitted to do so later (can't perform the save in the editor first before showing).

The process is:

  1. User clicks Preview
  2. Popup window is opened to blank page
  3. Post is saved
  4. After post finishes saving, blank page is redirected to preview

While we could direct the user to another page, since there'd be a load time associated with this, another option might be to write directly to the blank page with our intermediate messaging.

Demo: https://codepen.io/aduth/pen/jGJaYX

I've started work on this, will try and make a PR tomorrow.

Considering this as closed by #3157

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidsword picture davidsword  ·  3Comments

nylen picture nylen  ·  3Comments

spocke picture spocke  ·  3Comments

aaronjorbin picture aaronjorbin  ·  3Comments

BE-Webdesign picture BE-Webdesign  ·  3Comments