Fixing an unwanted page refresh when using Woo Navigation (https://github.com/woocommerce/woocommerce-admin/pull/7615)
* Adding changelog * Fixing page refresh on woo navigation * Narrowing scope of navigation slot fills
This commit is contained in:
parent
3b3472595e
commit
3ee60dc833
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: Fix
|
||||||
|
|
||||||
|
Fixing an unwanted page refresh when using Woo Navigation
|
|
@ -174,6 +174,9 @@ class _Layout extends Component {
|
||||||
) }
|
) }
|
||||||
</div>
|
</div>
|
||||||
<PluginArea scope="woocommerce-admin" />
|
<PluginArea scope="woocommerce-admin" />
|
||||||
|
{ window.wcAdminFeatures.navigation && (
|
||||||
|
<PluginArea scope="woocommerce-navigation" />
|
||||||
|
) }
|
||||||
</SlotFillProvider>
|
</SlotFillProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,4 +93,5 @@ const NavigationPlugin = () => {
|
||||||
|
|
||||||
registerPlugin( 'wc-admin-navigation', {
|
registerPlugin( 'wc-admin-navigation', {
|
||||||
render: NavigationPlugin,
|
render: NavigationPlugin,
|
||||||
|
scope: 'woocommerce-navigation',
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
*/
|
*/
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { Button } from '@wordpress/components';
|
import { Button } from '@wordpress/components';
|
||||||
import { registerPlugin } from "@wordpress/plugins";
|
import { registerPlugin } from '@wordpress/plugins';
|
||||||
import { WooNavigationItem } from "@woocommerce/navigation";
|
import { WooNavigationItem } from '@woocommerce/navigation';
|
||||||
|
|
||||||
const MyPlugin = () => {
|
const MyPlugin = () => {
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
alert( 'Menu item clicked!' );
|
alert( 'Menu item clicked!' );
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WooNavigationItem item="example-category-child-2">
|
<WooNavigationItem item="example-category-child-2">
|
||||||
|
@ -20,4 +20,7 @@ const MyPlugin = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
registerPlugin('my-plugin', { render: MyPlugin });
|
registerPlugin( 'my-plugin', {
|
||||||
|
render: MyPlugin,
|
||||||
|
scope: 'woocommerce-navigation',
|
||||||
|
} );
|
||||||
|
|
|
@ -121,5 +121,5 @@ const MyPlugin = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
registerPlugin('my-plugin', { render: MyPlugin });
|
registerPlugin( 'my-plugin', { render: MyPlugin, scope: 'woocommerce-navigation' } );
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue