mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@39502 git-svn-id: http://core.svn.wordpress.org/trunk@39442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c9b8a5dbbb
commit
97f4180916
@ -80,8 +80,6 @@
|
||||
});
|
||||
api.Menus.availableMenuItems = new api.Menus.AvailableItemCollection( api.Menus.data.availableMenuItems );
|
||||
|
||||
api.Menus.insertedAutoDrafts = [];
|
||||
|
||||
/**
|
||||
* Insert a new `auto-draft` post.
|
||||
*
|
||||
@ -104,8 +102,9 @@
|
||||
|
||||
request.done( function( response ) {
|
||||
if ( response.post_id ) {
|
||||
api.Menus.insertedAutoDrafts.push( response.post_id );
|
||||
api( 'nav_menus_created_posts' ).set( _.clone( api.Menus.insertedAutoDrafts ) );
|
||||
api( 'nav_menus_created_posts' ).set(
|
||||
api( 'nav_menus_created_posts' ).get().concat( [ response.post_id ] )
|
||||
);
|
||||
|
||||
if ( 'page' === params.post_type ) {
|
||||
|
||||
@ -2797,9 +2796,17 @@
|
||||
if ( data.nav_menu_updates || data.nav_menu_item_updates ) {
|
||||
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.
|
||||
|
4
wp-admin/js/customize-nav-menus.min.js
vendored
4
wp-admin/js/customize-nav-menus.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-39499';
|
||||
$wp_version = '4.8-alpha-39502';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user