widgetPartial = new self.WidgetPartial( partialId, {
params: {}
} );
- api.selectiveRefresh.partial.add( widgetPartial.id, widgetPartial );
}
// Make sure that there is a container element for the widget in the sidebar, if at least a placeholder.
wasInserted = true;
} );
+ api.selectiveRefresh.partial.add( widgetPartial.id, widgetPartial );
+
if ( wasInserted ) {
sidebarPartial.reflowWidgets();
}
// Remove class names that incorporate the string formatting placeholders %1$s and %2$s.
widgetClasses = widgetClasses.replace( /\S*%[12]\$s\S*/g, '' );
widgetClasses = widgetClasses.replace( /^\s+|\s+$/g, '' );
- widgetSelector += '.' + widgetClasses.split( /\s+/ ).join( '.' );
+ if ( widgetClasses ) {
+ widgetSelector += '.' + widgetClasses.split( /\s+/ ).join( '.' );
+ }
self.widgetSelectors.push( widgetSelector );
});
};
var self = this,
selector = this.widgetSelectors.join( ',' );
+ // Skip adding highlights if not in the customizer preview iframe.
+ if ( ! api.settings.channel ) {
+ return;
+ }
+
$( selector ).attr( 'title', this.l10n.widgetTooltip );
$( document ).on( 'mouseenter', selector, function() {