PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.8.0
GenerateBlocks v1.8.0
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / blocks / grid / block.js
generateblocks / src / blocks / grid Last commit date
components 2 years ago css 3 years ago attributes.js 2 years ago block.js 2 years ago deprecated.js 3 years ago edit.js 2 years ago editor.scss 4 years ago
block.js
61 lines
1 /**
2 * Block: Grid
3 */
4
5 import './editor.scss';
6 import editGridContainer from './edit';
7 import blockAttributes from './attributes';
8 import getIcon from '../../utils/get-icon';
9 import deprecated from './deprecated';
10 import { __ } from '@wordpress/i18n';
11 import { registerBlockType } from '@wordpress/blocks';
12 import { InnerBlocks } from '@wordpress/block-editor';
13 import { getBlockAttributes } from '../../block-context';
14 import gridContext from '../../block-context/grid';
15
16 const attributes = getBlockAttributes(
17 blockAttributes,
18 gridContext,
19 generateBlocksDefaults.gridContainer
20 );
21
22 /**
23 * Register our Grid block.
24 *
25 * @param {string} name Block name.
26 * @param {Object} settings Block settings.
27 * @return {?WPBlock} The block, if it has been successfully
28 * registered; otherwise `undefined`.
29 */
30 registerBlockType( 'generateblocks/grid', {
31 apiVersion: 2,
32 title: __( 'Grid', 'generateblocks' ),
33 description: __( 'Create advanced layouts with flexible grids.', 'generateblocks' ),
34 icon: getIcon( 'grid' ),
35 category: 'generateblocks',
36 keywords: [
37 __( 'grid' ),
38 __( 'column' ),
39 __( 'generate' ),
40 ],
41 attributes,
42 supports: {
43 className: false,
44 html: false,
45 },
46 edit: editGridContainer,
47 save: () => {
48 return (
49 <InnerBlocks.Content />
50 );
51 },
52 deprecated,
53 __experimentalLabel: ( attrs, { context } ) => {
54 if ( 'list-view' === context && attrs.blockLabel ) {
55 return attrs.blockLabel;
56 }
57
58 return __( 'Grid', 'generateblocks' );
59 },
60 } );
61