This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests and form submissions #70
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Add is_previewing_settings() and current_snapshot_uuid() helper functions. * Add example for how to bypass cache appropriately.
westonruter
changed the title
[WIP] Ensure frontend links and Ajax requests include UUID query param
Ensure frontend links and Ajax requests include UUID query param
Aug 8, 2016
westonruter
changed the title
Ensure frontend links and Ajax requests include UUID query param
Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests in Customizer Preview
Aug 8, 2016
This fixes #20714: Theme customizer: Impossible to preview a search results page <https://core.trac.wordpress.org/ticket/20714>
Add support for persisting the Customizer state through form submissions
westonruter
changed the title
Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests in Customizer Preview
Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests and form submissions
Aug 10, 2016
@westonruter Looks good! 👍 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When previewing a snapshot on the frontend, the admin bar is modified accordingly:
- (Unchanged) The “Customize” link takes you to the Customizer with that snapshot state applied. - The “Inspect Snapshot” link takes you to the edit post screen (formerly submenu item under Customize). - A new “Exit Snapshot Preview” link appears which removes the `customize_snapshot_uuid` query param from the current URL. - All other admin bar links are removed, other than those which already contain the `customize_snapshot_uuid` query param (as in the Airplane Mode toggle shown here), or which are in-page links, such as the query monitor link.
When you are navigating around the site with a snapshot applied, the
sessionStorage
will store the UUID for this snapshot. While the JS will attempt to inject thecustomize_snapshot_uuid
into all links in the document, if you do navigate away from a URL that has this query param, the JS on the new non-snapshotted page will see that you have a snapshot UUID insessionStorage
but no snapshot in the URL, and it will add an admin bar link to prompt you to resume the snapshot preview:This PR also ensures that Ajax requests made on the frontend include the
customize_snapshot_uuid
param so that the responses can be previewed. Additionally, Ajax requests made inside the Customizer preview also now get the Customizer state added so that their responses should be previewable as well.Lastly, forms that have
GET
request methods (such as the search form) now are actually usable in the Customizer preview! Likewise, forms on the frontend will persist the currentcustomize_snapshot_uuid
in the requests. This fixes a long-standing Trac ticket #20714: Theme customizer: Impossible to preview a search results page. See sub-PR #72.Fixes #47
Fixes #65