Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow external preview links in Preview dropdown to be extended #25309

Closed
westonruter opened this issue Sep 14, 2020 · 3 comments · Fixed by #64644
Closed

Allow external preview links in Preview dropdown to be extended #25309

westonruter opened this issue Sep 14, 2020 · 3 comments · Fixed by #64644
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@westonruter
Copy link
Member

In the AMP plugin, we introduce a separate Preview button to be able to preview how the page appears in AMP. We had to put in place a bunch of hacks to get this to work in the block editor since the area around the preview button is not extensible. See ampproject/amp-wp#4397. The button looks like this (screenshot courtesy of @simison):

AMP Preview button

Unfortunately, this broke in Gutenberg 8.8. But this is not surprising since it was implemented with hacks. We actually don't want to have a separate AMP preview button in the first place. Ideally the AMP preview link would be exposed in the relatively new device preview dropdown (ampproject/amp-wp#4368 (comment)), as also was suggested in Automattic/wp-calypso#42896:

Preview dropdown

However, we weren't able to do so given that this dropdown is not extensible.

So my request is that the Preview dropdown menu items be extensible. Plugins should be able to add their own preview links in addition to "Preview externally". This will be useful not only for AMP, but it could also be used by other plugins that may provide alternate representations of the content (e.g. FB Instant Articles, Apple News) or even as a way to link to preview the content on a site that is using WordPress headlessly.

This relates to #21235 which is about extending the non-external preview options.

@simison
Copy link
Member

simison commented Sep 14, 2020

Could be also used to preview:

  • social media shares,
  • dark mode for websites that implement it (while editor stays light mode by default)
  • and additional display sizes for more exotic targets such as televisions.

@youknowriad youknowriad added the [Feature] Extensibility The ability to extend blocks or the editing experience label Sep 15, 2020
@simison
Copy link
Member

simison commented Sep 18, 2020

PR: #25430

@fumikito
Copy link

+1 for this.

Custom post type with public => false, show_ui => true is commonly used.
Marketing mail plugin, eBook generator, and so on.

Creating a preview screen is responsible for plugin authors, but it's more agreeable with an extensible preview area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
5 participants