mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
🐛 Isolate preview changes to relevant sections
Before this, any style change updated all preview buttons on the current page. Now, most changes are limited to the current section. For exaple, changing the height of “Mini Cart Buttons” only updates the mini cart button preview, and no other preview sections.
This commit is contained in:
parent
07ec924c77
commit
a4a4f80a99
1 changed files with 11 additions and 0 deletions
|
@ -283,6 +283,17 @@ class PreviewButtonManager {
|
|||
*/
|
||||
_configureAllButtons( ppcpConfig ) {
|
||||
Object.entries( this.buttons ).forEach( ( [ id, button ] ) => {
|
||||
const limitWrapper = ppcpConfig.button?.wrapper;
|
||||
|
||||
/**
|
||||
* When the ppcpConfig object specifies a button wrapper, then ensure to limit preview
|
||||
* changes to this individual wrapper. If no button wrapper is defined, the
|
||||
* configuration is relevant for all buttons on the page.
|
||||
*/
|
||||
if ( limitWrapper && button.wrapper !== limitWrapper ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._configureButton( id, {
|
||||
...ppcpConfig,
|
||||
button: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue