/
index.js
50 lines (46 loc) · 1.22 KB
/
index.js
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
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import deprecated from './deprecated';
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
const { name } = metadata;
export { metadata, name };
export const settings = {
title: __( 'Paragraph' ),
description: __( 'Start with the building block of all narrative.' ),
icon,
keywords: [ __( 'text' ) ],
example: {
attributes: {
content: __( 'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.' ),
customFontSize: 28,
dropCap: true,
},
},
supports: {
className: false,
},
transforms,
deprecated,
merge( attributes, attributesToMerge ) {
return {
content: ( attributes.content || '' ) + ( attributesToMerge.content || '' ),
};
},
getEditWrapperProps( attributes ) {
const { width } = attributes;
if ( [ 'wide', 'full', 'left', 'right' ].indexOf( width ) !== -1 ) {
return { 'data-align': width };
}
},
edit,
save,
};