Opened 8 years ago
Closed 6 years ago
#43386 closed enhancement (maybelater)
render-partials-init similar to render-partials-response in customiser selective refresh.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.5 |
| Component: | Customize | Keywords: | |
| Focuses: | ui, javascript, administration | Cc: |
Description
These are the events that are triggered when a selective refresh takes place.
render-partials-response partial-content-rendered partial-placement-moved widget-updated sidebar-updated
But there is no event to identify the start of the partial request. This is required if we want to make some changes (like display a loader) to the UI while the request in progress.
.customize-partial-refreshing class is added while the partial refresh is in progress, but a javascript event will be handy.
Use case: Partial used to update a style tag in the head.
adding the following event after initiating the request in
wp-includes/js/customize-selective-refresh.js at line 773 works, but not sure if it the right way.
self.trigger( 'render-partials-init', data );
Change History (4)
Note: See
TracTickets for help on using
tickets.
I think we can override the preparePlacement method and do the UI changes there, but still if we can fire an event in the prepare placement method it would be useful.
/** * Prepare container for selective refresh. * * @since 4.5.0 * * @param {Placement} placement */ preparePlacement: function( placement ) { $( placement.container ).addClass( 'customize-partial-refreshing' ); self.trigger( 'partial-content-initiated', placement ); },