Customize: Ensure edit shortcuts get re-created for nested partials when a parent partial is refreshed.

Fixes issue where the edit shortcut for a nav menu gets dropped when the containing Custom Menu widget is updated.

See #39101.
Fixes #39353.

Built from https://develop.svn.wordpress.org/trunk@40055


git-svn-id: http://core.svn.wordpress.org/trunk@39992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-02-11 03:35:43 +00:00
parent fe0b8a2aaf
commit f3644a702e
3 changed files with 13 additions and 8 deletions

View File

@ -849,7 +849,7 @@ wp.customize.selectiveRefresh = ( function( $, api ) {
containerElements = containerElements.add( rootElement ); containerElements = containerElements.add( rootElement );
} }
containerElements.each( function() { containerElements.each( function() {
var containerElement = $( this ), partial, id, Constructor, partialOptions, containerContext; var containerElement = $( this ), partial, placement, id, Constructor, partialOptions, containerContext;
id = containerElement.data( 'customize-partial-id' ); id = containerElement.data( 'customize-partial-id' );
if ( ! id ) { if ( ! id ) {
return; return;
@ -874,14 +874,19 @@ wp.customize.selectiveRefresh = ( function( $, api ) {
*/ */
if ( options.triggerRendered && ! containerElement.data( 'customize-partial-content-rendered' ) ) { if ( options.triggerRendered && ! containerElement.data( 'customize-partial-content-rendered' ) ) {
/** placement = new Placement( {
* Announce when a partial's nested placement has been re-rendered.
*/
self.trigger( 'partial-content-rendered', new Placement( {
partial: partial, partial: partial,
context: containerContext, context: containerContext,
container: containerElement container: containerElement
} ) ); } );
$( placement.container ).attr( 'title', self.data.l10n.shiftClickToEdit );
partial.createEditShortcutForPlacement( placement );
/**
* Announce when a partial's nested placement has been re-rendered.
*/
self.trigger( 'partial-content-rendered', placement );
} }
containerElement.data( 'customize-partial-content-rendered', true ); containerElement.data( 'customize-partial-content-rendered', true );
} ); } );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-alpha-40054'; $wp_version = '4.8-alpha-40055';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.