From 61752051def35d3ff4d165eb39d0c40b78eb18d8 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 11 Feb 2017 03:34:10 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@40055 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/customize-selective-refresh.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/js/customize-selective-refresh.js b/src/wp-includes/js/customize-selective-refresh.js index d3b81db6d7..4f7165656a 100644 --- a/src/wp-includes/js/customize-selective-refresh.js +++ b/src/wp-includes/js/customize-selective-refresh.js @@ -849,7 +849,7 @@ wp.customize.selectiveRefresh = ( function( $, api ) { containerElements = containerElements.add( rootElement ); } 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' ); if ( ! id ) { return; @@ -874,14 +874,19 @@ wp.customize.selectiveRefresh = ( function( $, api ) { */ if ( options.triggerRendered && ! containerElement.data( 'customize-partial-content-rendered' ) ) { - /** - * Announce when a partial's nested placement has been re-rendered. - */ - self.trigger( 'partial-content-rendered', new Placement( { + placement = new Placement( { partial: partial, context: containerContext, 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 ); } );