Changeset 27584
- Timestamp:
- 03/18/2014 03:20:38 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-widgets.js
r27540 r27584 1443 1443 var control = this, 1444 1444 widget_customizer_preview = self.getPreviewWindow().WidgetCustomizerPreview; 1445 return widget_customizer_preview.get SidebarWidgetElement( control.params.sidebar_id,control.params.widget_id );1445 return widget_customizer_preview.getWidgetElement( control.params.widget_id ); 1446 1446 }, 1447 1447 -
trunk/src/wp-includes/class-wp-customize-widgets.php
r27543 r27584 757 757 ); 758 758 759 /* 760 wp_enqueue_style( 761 'widget-customizer-preview', 762 'widget-customizer-preview.css' 763 ); 764 */ 759 add_action( 'wp_print_styles', array( __CLASS__, 'inject_preview_css' ), 1 ); 765 760 766 761 // Why not wp_localize_script? Because we're not localizing, and it forces values into strings … … 782 777 sprintf( 'var WidgetCustomizerPreview_exports = %s;', json_encode( $exports ) ) 783 778 ); 779 } 780 781 /** 782 * Insert default style for highlighted widget at early point so theme 783 * stylesheet can override. 784 * 785 * @action wp_print_styles 786 */ 787 static function inject_preview_css() { 788 ?> 789 <style> 790 .widget-customizer-highlighted-widget { 791 border-radius: 2px; 792 outline: none; 793 box-shadow: 0 0 3px #ce0000; 794 } 795 </style> 796 <?php 784 797 } 785 798 -
trunk/src/wp-includes/js/customize-preview-widgets.js
r27436 r27584 53 53 54 54 /** 55 * Obtain a widget instance if it was added to the provided sidebar56 * This addresses a race condition where a widget is moved between sidebars57 * We cannot use ID selector because jQuery will only return the first one58 * that matches. We have to resort to an [id] attribute selector55 * Obtain a rendered widget element. Assumes standard practice of using 56 * the widget ID as the ID for the DOM element. To eliminate this 57 * assumption, additional data-* attributes would need to be injected 58 * onto the rendered widget root element. 59 59 * 60 * @param {String} sidebar_id61 60 * @param {String} widget_id 62 61 * @return {jQuery} 63 62 */ 64 getSidebarWidgetElement: function ( sidebar_id, widget_id ) { 65 return $( '[id=' + widget_id + ']' ).filter( function () { 66 return $( this ).data( 'widget_customizer_sidebar_id' ) === sidebar_id; 67 } ); 63 getWidgetElement: function ( widget_id ) { 64 return $( '#' + widget_id ); 68 65 }, 69 66
Note: See TracChangeset
for help on using the changeset viewer.