mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@35783 git-svn-id: http://core.svn.wordpress.org/trunk@35747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a9da055b5b
commit
76fe3244eb
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
if ( ! wp || ! wp.customize ) { return; }
|
if ( ! wp || ! wp.customize ) { return; }
|
||||||
|
|
||||||
var api = wp.customize,
|
var api = wp.customize;
|
||||||
OldPreview;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wp.customize.WidgetCustomizerPreview
|
* wp.customize.WidgetCustomizerPreview
|
||||||
@ -20,6 +19,8 @@
|
|||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
this.preview = api.preview;
|
||||||
this.buildWidgetSelectors();
|
this.buildWidgetSelectors();
|
||||||
this.highlightControls();
|
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 () {
|
$(function () {
|
||||||
var settings = window._wpWidgetCustomizerPreviewSettings;
|
var settings = window._wpWidgetCustomizerPreviewSettings;
|
||||||
if ( ! settings ) {
|
if ( ! settings ) {
|
||||||
|
@ -1 +1 @@
|
|||||||
!function(a,b){if(a&&a.customize){var c,d=a.customize;d.WidgetCustomizerPreview={renderedSidebars:{},renderedWidgets:{},registeredSidebars:[],registeredWidgets:{},widgetSelectors:[],preview:null,l10n:{},init:function(){var a=this;this.buildWidgetSelectors(),this.highlightControls(),this.preview.bind("highlight-widget",a.highlightWidget)},buildWidgetSelectors:function(){var a=this;b.each(this.registeredSidebars,function(c,d){var e,f,g,h=[d.before_widget.replace("%1$s","").replace("%2$s",""),d.before_title,d.after_title,d.after_widget].join("");e=b(h),f=e.prop("tagName"),g=e.prop("className"),g&&(g=g.replace(/^\s+|\s+$/g,""),g&&(f+="."+g.split(/\s+/).join(".")),a.widgetSelectors.push(f))})},highlightWidget:function(a){var c=b(document.body),d=b("#"+a);c.find(".widget-customizer-highlighted-widget").removeClass("widget-customizer-highlighted-widget"),d.addClass("widget-customizer-highlighted-widget"),setTimeout(function(){d.removeClass("widget-customizer-highlighted-widget")},500)},highlightControls:function(){var a=this,c=this.widgetSelectors.join(",");b(c).attr("title",this.l10n.widgetTooltip),b(document).on("mouseenter",c,function(){a.preview.send("highlight-widget-control",b(this).prop("id"))}),b(document).on("click",c,function(c){c.shiftKey&&(c.preventDefault(),a.preview.send("focus-widget-control",b(this).prop("id")))})}},c=d.Preview,d.Preview=c.extend({initialize:function(a,b){d.WidgetCustomizerPreview.preview=this,c.prototype.initialize.call(this,a,b)}}),b(function(){var a=window._wpWidgetCustomizerPreviewSettings;a&&(b.extend(d.WidgetCustomizerPreview,a),d.WidgetCustomizerPreview.init())})}}(window.wp,jQuery);
|
!function(a,b){if(a&&a.customize){var c=a.customize;c.WidgetCustomizerPreview={renderedSidebars:{},renderedWidgets:{},registeredSidebars:[],registeredWidgets:{},widgetSelectors:[],preview:null,l10n:{},init:function(){var a=this;this.preview=c.preview,this.buildWidgetSelectors(),this.highlightControls(),this.preview.bind("highlight-widget",a.highlightWidget)},buildWidgetSelectors:function(){var a=this;b.each(this.registeredSidebars,function(c,d){var e,f,g,h=[d.before_widget.replace("%1$s","").replace("%2$s",""),d.before_title,d.after_title,d.after_widget].join("");e=b(h),f=e.prop("tagName"),g=e.prop("className"),g&&(g=g.replace(/^\s+|\s+$/g,""),g&&(f+="."+g.split(/\s+/).join(".")),a.widgetSelectors.push(f))})},highlightWidget:function(a){var c=b(document.body),d=b("#"+a);c.find(".widget-customizer-highlighted-widget").removeClass("widget-customizer-highlighted-widget"),d.addClass("widget-customizer-highlighted-widget"),setTimeout(function(){d.removeClass("widget-customizer-highlighted-widget")},500)},highlightControls:function(){var a=this,c=this.widgetSelectors.join(",");b(c).attr("title",this.l10n.widgetTooltip),b(document).on("mouseenter",c,function(){a.preview.send("highlight-widget-control",b(this).prop("id"))}),b(document).on("click",c,function(c){c.shiftKey&&(c.preventDefault(),a.preview.send("focus-widget-control",b(this).prop("id")))})}},b(function(){var a=window._wpWidgetCustomizerPreviewSettings;a&&(b.extend(c.WidgetCustomizerPreview,a),c.WidgetCustomizerPreview.init())})}}(window.wp,jQuery);
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-35782';
|
$wp_version = '4.5-alpha-35783';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user