Customizer: Re-use public api.preview
instance in widgets preview instead of unnecessarily capturing in api.Preview
constructor wrapper.
The preview instance is no longer private. Props joshlevinson, westonruter. Fixes #30890. See #30726. git-svn-id: https://develop.svn.wordpress.org/trunk@35783 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
775b27d8a5
commit
1b2dae4668
@ -2,8 +2,7 @@
|
||||
|
||||
if ( ! wp || ! wp.customize ) { return; }
|
||||
|
||||
var api = wp.customize,
|
||||
OldPreview;
|
||||
var api = wp.customize;
|
||||
|
||||
/**
|
||||
* wp.customize.WidgetCustomizerPreview
|
||||
@ -20,6 +19,8 @@
|
||||
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
this.preview = api.preview;
|
||||
this.buildWidgetSelectors();
|
||||
this.highlightControls();
|
||||
|
||||
@ -104,17 +105,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Capture the instance of the Preview since it is private
|
||||
*/
|
||||
OldPreview = api.Preview;
|
||||
api.Preview = OldPreview.extend( {
|
||||
initialize: function( params, options ) {
|
||||
api.WidgetCustomizerPreview.preview = this;
|
||||
OldPreview.prototype.initialize.call( this, params, options );
|
||||
}
|
||||
} );
|
||||
|
||||
$(function () {
|
||||
var settings = window._wpWidgetCustomizerPreviewSettings;
|
||||
if ( ! settings ) {
|
||||
|
Loading…
Reference in New Issue
Block a user