Remove attributes data from save function for filter by price (https://github.com/woocommerce/woocommerce-blocks/pull/10039)
This commit is contained in:
parent
aa48386834
commit
f8cf9fe97a
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import classNames from 'classnames';
|
||||
import { useBlockProps } from '@wordpress/block-editor';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import metadata from './block.json';
|
||||
import { blockAttributes } from './attributes';
|
||||
import type { Attributes } from './types';
|
||||
|
||||
const v1 = {
|
||||
attributes: {
|
||||
...metadata.attributes,
|
||||
...blockAttributes,
|
||||
},
|
||||
save: ( { attributes }: { attributes: Attributes } ) => {
|
||||
const {
|
||||
className,
|
||||
showInputFields,
|
||||
showFilterButton,
|
||||
heading,
|
||||
headingLevel,
|
||||
} = attributes;
|
||||
const data = {
|
||||
'data-showinputfields': showInputFields,
|
||||
'data-showfilterbutton': showFilterButton,
|
||||
'data-heading': heading,
|
||||
'data-heading-level': headingLevel,
|
||||
};
|
||||
return (
|
||||
<div
|
||||
{ ...useBlockProps.save( {
|
||||
className: classNames( 'is-loading', className ),
|
||||
} ) }
|
||||
{ ...data }
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
className="wc-block-product-categories__placeholder"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
const deprecated = [ v1 ];
|
||||
|
||||
export default deprecated;
|
|
@ -12,6 +12,7 @@ import { useBlockProps } from '@wordpress/block-editor';
|
|||
import edit from './edit';
|
||||
import metadata from './block.json';
|
||||
import { blockAttributes } from './attributes';
|
||||
import deprecated from './deprecated';
|
||||
|
||||
registerBlockType( metadata, {
|
||||
icon: {
|
||||
|
@ -28,25 +29,12 @@ registerBlockType( metadata, {
|
|||
},
|
||||
edit,
|
||||
save( { attributes } ) {
|
||||
const {
|
||||
className,
|
||||
showInputFields,
|
||||
showFilterButton,
|
||||
heading,
|
||||
headingLevel,
|
||||
} = attributes;
|
||||
const data = {
|
||||
'data-showinputfields': showInputFields,
|
||||
'data-showfilterbutton': showFilterButton,
|
||||
'data-heading': heading,
|
||||
'data-heading-level': headingLevel,
|
||||
};
|
||||
const { className } = attributes;
|
||||
return (
|
||||
<div
|
||||
{ ...useBlockProps.save( {
|
||||
className: classNames( 'is-loading', className ),
|
||||
} ) }
|
||||
{ ...data }
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
|
@ -55,4 +43,5 @@ registerBlockType( metadata, {
|
|||
</div>
|
||||
);
|
||||
},
|
||||
deprecated,
|
||||
} );
|
||||
|
|
Loading…
Reference in New Issue