Conversation
…nto feature/trac-34893-validation
… posted value is invalid
…nto feature/trac-34893-validation
js/customize-preview-posts.js
Outdated
There was a problem hiding this comment.
@valendesigns I think this isn't right. The saved event is triggered on the api inside the controls itself. Why send this customized-posts-purge-trash message from the preview?
Why not just do in customize-posts.js:
api.bind( 'saved', function() {
component.purgeTrash();
} );There was a problem hiding this comment.
is_singular() always returned false when called from the pane. So I needed access to that value to force the preview to reload the archive.
There was a problem hiding this comment.
I think it would be better to keep track of whatever the last data sent from customized-posts was instead.
component.previewedQuery = new api.Value( {} );
api.previewer.bind( 'customized-posts', function ( data ) {
var query = {};
_.each( [ 'isSingular', 'isPostPreview', 'queriedPostId' ] ).each( function( key ) {
query[ key ] = data[ key ];
} );
component.previewedQuery.set( query );
} );Then at any time you can access whether the preview isSingular via query.previewedQuery.get().isSingular.
This would be a basic implementation of https://core.trac.wordpress.org/ticket/36582
There was a problem hiding this comment.
This needs to be:
$result = wp_trash_post( $this->post_id );
|
There was a problem hiding this comment.
I think this is wrong. We should instead be doing this change below:
if ( 'trash' !== $post_data['post_status'] && apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $post_data ) ) {
Fixes #40, fixes #137