PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.7.2
GenerateBlocks v1.7.2
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 / container / block.js
generateblocks / src / blocks / container Last commit date
components 3 years ago css 3 years ago variations 3 years ago attributes.js 3 years ago block-controls.js 3 years ago block.js 3 years ago deprecated.js 5 years ago edit.js 3 years ago editor.scss 3 years ago migrate-sizing.js 3 years ago
block.js
65 lines
1 /**
2 * Block: Container
3 */
4
5 import './editor.scss';
6 import './block-controls.js';
7
8 import containerEdit from './edit';
9 import blockAttributes from './attributes';
10 import deprecated from './deprecated';
11 import getIcon from '../../utils/get-icon';
12 import { __ } from '@wordpress/i18n';
13 import { registerBlockType } from '@wordpress/blocks';
14 import { InnerBlocks } from '@wordpress/block-editor';
15 import dynamicContentAttributes from '../../extend/dynamic-content/attributes';
16 import { getBlockAttributes } from '../../block-context';
17 import containerContext from '../../block-context/container';
18 import './variations';
19
20 const attributes = Object.assign(
21 {},
22 getBlockAttributes( blockAttributes, containerContext, generateBlocksDefaults.container ),
23 dynamicContentAttributes
24 );
25
26 /**
27 * Register our Container block.
28 *
29 * @param {string} name Block name.
30 * @param {Object} settings Block settings.
31 * @return {?WPBlock} The block, if it has been successfully
32 * registered; otherwise `undefined`.
33 */
34 registerBlockType( 'generateblocks/container', {
35 apiVersion: 2,
36 title: __( 'Container', 'generateblocks' ),
37 description: __( 'Organize your content into rows and sections.', 'generateblocks' ),
38 icon: getIcon( 'container' ),
39 category: 'generateblocks',
40 keywords: [
41 __( 'section' ),
42 __( 'container' ),
43 __( 'generate' ),
44 ],
45 attributes,
46 supports: {
47 align: false,
48 className: false,
49 html: false,
50 },
51 usesContext: [ 'postId', 'postType', 'generateblocks/queryId' ],
52 edit: containerEdit,
53 save: () => {
54 return (
55 <InnerBlocks.Content />
56 );
57 },
58 deprecated,
59 __experimentalLabel: ( attrs ) => {
60 return attrs.isQueryLoopItem
61 ? __( 'Post Template', 'generateblocks' )
62 : __( 'Container', 'generateblocks' );
63 },
64 } );
65