This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +45
-53
lines changed
assets/js/atomic/blocks/product-elements/price-v2 Expand file tree Collapse file tree 4 files changed +45
-53
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ {
2+ "$schema" : " http://schemas.wp.org/trunk/block.json" ,
3+ "apiVersion" : 2 ,
4+ "name" : " woocommerce/product-price-v2" ,
5+ "title" : " Price" ,
6+ "keywords" : " WooCommerce" ,
7+ "category" : " woocommerce-product-elements" ,
8+ "textdomain" : " woo-gutenberg-products-block" ,
9+ "description" : " Display the price of a product, including any discounts." ,
10+ "supports" : {
11+ "__experimentalLayout" : {
12+ "allowSwitching" : false ,
13+ "allowInheriting" : false ,
14+ "default" : { "type" : " flex" }
15+ },
16+ "html" : false
17+
18+ },
19+ "usesContext" : [ " queryId" , " postId" ],
20+ "providesContext" : {
21+ "woocommerce/isDescendentOfSingleProductTemplate" :
22+ " isDescendentOfSingleProductTemplate" ,
23+ "woocommerce/isDescendentOfSingleProductBlock" :
24+ " woocommerce/isDescendentOfSingleProductBlock"
25+ },
26+ "attributes" : {
27+ "isDescendentOfSingleProductTemplate" : {
28+ "type" : " boolean" ,
29+ "default" : false
30+ },
31+ "isDescendentOfSingleProductBlock" : {
32+ "type" : " boolean" ,
33+ "default" : false
34+ },
35+ "productId" : {
36+ "type" : " number" ,
37+ "default" : 0
38+ }
39+ }
40+ }
Original file line number Diff line number Diff line change 11/**
22 * External dependencies
33 */
4- import { __ } from '@wordpress/i18n' ;
54import { currencyDollar , Icon } from '@wordpress/icons' ;
65
7- export const BLOCK_TITLE : string = __ (
8- 'Price' ,
9- 'woo-gutenberg-products-block'
10- ) ;
116export const BLOCK_ICON : JSX . Element = (
127 < Icon
138 icon = { currencyDollar }
149 className = "wc-block-editor-components-block-icon"
1510 />
1611) ;
17- export const BLOCK_DESCRIPTION : string = __ (
18- 'Display the price of a product, including any discounts.' ,
19- 'woo-gutenberg-products-block'
20- ) ;
Original file line number Diff line number Diff line change @@ -6,36 +6,18 @@ import { registerBlockType } from '@wordpress/blocks';
66/**
77 * Internal dependencies
88 */
9- import sharedConfig from '../shared/config' ;
109import edit from './edit' ;
1110import save from './save' ;
12- import attributes from './attributes' ;
1311import { supports } from './supports' ;
14- import {
15- BLOCK_TITLE as title ,
16- BLOCK_ICON as icon ,
17- BLOCK_DESCRIPTION as description ,
18- } from './constants' ;
19-
20- const { ancestor, ...configuration } = sharedConfig ;
12+ import metadata from './block.json' ;
13+ import { BLOCK_ICON as icon } from './constants' ;
2114
2215const blockConfig = {
23- ...configuration ,
24- apiVersion : 2 ,
25- title,
26- description,
27- usesContext : [ 'postId' , 'queryId' ] ,
28- providesContext : {
29- 'woocommerce/isDescendentOfSingleProductTemplate' :
30- 'isDescendentOfSingleProductTemplate' ,
31- 'woocommerce/isDescendentOfSingleProductBlock' :
32- 'isDescendentOfSingleProductBlock' ,
33- } ,
16+ ...metadata ,
3417 icon : { src : icon } ,
35- attributes,
36- supports,
18+ supports : { ...supports , ...metadata . supports } ,
3719 edit,
3820 save,
3921} ;
4022
41- registerBlockType ( 'woocommerce/product-price-v2' , blockConfig ) ;
23+ registerBlockType ( metadata . name , blockConfig ) ;
You can’t perform that action at this time.
0 commit comments