Customize: Prevent posts/pages imported via starter content from being dropped when adding post/page stubs via nav menus and the dropdown-pages control.
Props westonruter, dlh for testing. See #38114, #34923. Fixes #39071. git-svn-id: https://develop.svn.wordpress.org/trunk@39502 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
01876b9888
commit
206b11aa40
@ -80,8 +80,6 @@
|
|||||||
});
|
});
|
||||||
api.Menus.availableMenuItems = new api.Menus.AvailableItemCollection( api.Menus.data.availableMenuItems );
|
api.Menus.availableMenuItems = new api.Menus.AvailableItemCollection( api.Menus.data.availableMenuItems );
|
||||||
|
|
||||||
api.Menus.insertedAutoDrafts = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new `auto-draft` post.
|
* Insert a new `auto-draft` post.
|
||||||
*
|
*
|
||||||
@ -104,8 +102,9 @@
|
|||||||
|
|
||||||
request.done( function( response ) {
|
request.done( function( response ) {
|
||||||
if ( response.post_id ) {
|
if ( response.post_id ) {
|
||||||
api.Menus.insertedAutoDrafts.push( response.post_id );
|
api( 'nav_menus_created_posts' ).set(
|
||||||
api( 'nav_menus_created_posts' ).set( _.clone( api.Menus.insertedAutoDrafts ) );
|
api( 'nav_menus_created_posts' ).get().concat( [ response.post_id ] )
|
||||||
|
);
|
||||||
|
|
||||||
if ( 'page' === params.post_type ) {
|
if ( 'page' === params.post_type ) {
|
||||||
|
|
||||||
@ -2797,9 +2796,17 @@
|
|||||||
if ( data.nav_menu_updates || data.nav_menu_item_updates ) {
|
if ( data.nav_menu_updates || data.nav_menu_item_updates ) {
|
||||||
api.Menus.applySavedData( data );
|
api.Menus.applySavedData( data );
|
||||||
}
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
// Reset list of inserted auto draft post IDs.
|
/*
|
||||||
api.Menus.insertedAutoDrafts = [];
|
* Reset the list of posts created in the customizer once published.
|
||||||
|
* The setting is updated quietly (bypassing events being triggered)
|
||||||
|
* so that the customized state doesn't become immediately dirty.
|
||||||
|
*/
|
||||||
|
api.state( 'changesetStatus' ).bind( function( status ) {
|
||||||
|
if ( 'publish' === status ) {
|
||||||
|
api( 'nav_menus_created_posts' )._value = [];
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Open and focus menu control.
|
// Open and focus menu control.
|
||||||
|
Loading…
Reference in New Issue
Block a user