This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
/
Copy pathindex.ts
61 lines (58 loc) · 1.46 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* eslint-disable @wordpress/no-unsafe-wp-apis */
/**
* External dependencies
*/
import { registerBlockType } from '@wordpress/blocks';
import type { BlockConfiguration } from '@wordpress/blocks';
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
import { __experimentalGetSpacingClassesAndStyles } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import sharedConfig from '../shared/config';
import attributes from './attributes';
import edit from './edit';
import {
BLOCK_TITLE as title,
BLOCK_ICON as icon,
BLOCK_DESCRIPTION as description,
} from './constants';
import { Save } from './save';
const blockConfig: BlockConfiguration = {
...sharedConfig,
apiVersion: 2,
title,
description,
icon: { src: icon },
attributes,
edit,
save: Save,
supports: {
...sharedConfig.supports,
...( isFeaturePluginBuild() && {
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontWeight: true,
__experimentalTextTransform: true,
__experimentalFontFamily: true,
},
color: {
text: true,
background: true,
link: false,
gradients: true,
__experimentalSkipSerialization: true,
},
...( typeof __experimentalGetSpacingClassesAndStyles ===
'function' && {
spacing: {
margin: true,
__experimentalSkipSerialization: true,
},
} ),
__experimentalSelector: '.wc-block-components-product-title',
} ),
},
};
registerBlockType( 'woocommerce/product-title', blockConfig );