Remove sessionStorage and use changeset to save post editor screen data.#350
Remove sessionStorage and use changeset to save post editor screen data.#350westonruter merged 24 commits intodevelopfrom
Conversation
js/edit-post-preview-admin.js
Outdated
| } | ||
|
|
||
| wp.customize.Loader.open( component.data.customize_url ); | ||
| wp.customize.Loader.settings.browser.mobile = wasMobile; |
There was a problem hiding this comment.
I think this needs to be put right after each of the wp.customize.Loader.open calls, especially the second since it is async.
php/class-edit-post-preview.php
Outdated
| global $wp_customize; | ||
|
|
||
| $previewed_post_id = absint( wp_unslash( $_POST['previewed_post'] ) ); | ||
| $changeset_uuid = get_post_meta( $previewed_post_id, '_changeset_uuid', true ); |
There was a problem hiding this comment.
Maybe _preview_changeset_uuid would be better.
…published, add checks for publish changeset and review feedback.
…side customizer post preview.
php/class-edit-post-preview.php
Outdated
| wp_unslash( $_POST['customize_url'] ) | ||
| ); | ||
|
|
||
| $wp_customize_posts = new WP_Customize_Posts( $wp_customize ); |
There was a problem hiding this comment.
Wouldn't we be able to use $wp_customize->posts here?
There was a problem hiding this comment.
Absolutely, that's what I had done first but then phpStorm was not able to recognize $wp_customize->posts, so.. that's probably a weird reason.
There was a problem hiding this comment.
Yeah, you're right. It's because Customize Posts is adding the posts property without it being declared. So I added a workaround here by adding an explicit type declaration.
| wp_send_json_error( 'missing_input_data' ); | ||
| } | ||
|
|
||
| $previewed_post_id = intval( wp_unslash( $_POST['previewed_post'] ) ); |
There was a problem hiding this comment.
Note that this was previously absint. The use of this is function to sanitize integers is being discouraged in core now in favor of intval so that negative numbers won't get silently converted into something that could be a real post.
westonruter
left a comment
There was a problem hiding this comment.
@sayedtaqui The experience here when previewing a post in the customizer is way better with your changes here. 🎉
Check out my changes and if they get your 👍 feel free to merge.
|
Oh, adding a unit test for |
|
@westonruter Please review my changes, ( Dont have merge access ) |
Fixes #338