Preview: Enable published posts preview#7189
Merged
aduth merged 13 commits intofix/autosave-previewfrom Jun 11, 2018
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes (when #7130 is merged): #7179
Closes (when #7130 is merged): #2544
Related: #6257, #6882
Note: Merges to
fix/autosave-preview(#7130) as base branch.Note: As best I can tell, this branch is fully functional, but I have plans to include new end-to-end tests for various preview circumstances prior to merge.
This pull request seeks to allow the user to preview changes to a published post without first updating the post (i.e. the autosave revision preview).
In doing so, it...
PostPreviewButtoncomponent to avoid relying on a specific save workflow, and instead leverage the mere availability of a preview linkpreview_linkfrom the posts endpoints and adds instead to the autosaves endpoint (see REST API: Autosaves entities should includepreview_link#7179)To the latter point, I landed at the conclusion that
preview_linkonly makes sense in the context of autsosaves on consideration of:post.linkas its preview._set_preview,wp_get_post_autosave).Related Trac tickets:
Thus, if there are no unsaved changes for a post, the Preview button is effectively a link to
post.link. If there are unsaved changes, the autosave is triggered and once its responses'autosave.preview_linkbecomes accessible, it is used in the redirect (regardless of whether or not the autosave occurred as a full save as described in #7124).