WordPress / revisions-extended

71 stars 11 forks source link

Missing preview for update CPTs #81

Open harishankerr opened 3 years ago

harishankerr commented 3 years ago

The preview option is missing for update CPTs, not sure if it is intentional - but I think it would be nice for folks to preview an update:

https://d.pr/i/hFYSn2 Full Size: https://d.pr/i/hFYSn2

StevenDufresne commented 3 years ago

This is happening because a revision is not considered viewable by Gutenberg: https://github.com/WordPress/gutenberg/blob/be99190729260def2f2de6ddc856fb703258b475/packages/editor/src/components/post-preview-button/index.js#L248

This property is returned by the Rest API and originates here: https://github.com/WordPress/wordpress-develop/blob/b22c4a1dce7135e439e05cd8f65b0ba8ebf52438/src/wp-includes/post.php#L2047

I'm not certain if we want to make revisions publicly viewable nor I am not the best resource to make that call. @coreymckrill Thoughts?

coreymckrill commented 3 years ago

I don't think we should alter the config of the revisions post type to make it publicly queryable. But there might be a way to modify the way previews work so that they can load from an update (currently they only use autosaves, I think). I'll take a look.