css
5 years ago
attributes.js
4 years ago
block.js
4 years ago
deprecated.js
5 years ago
edit.js
4 years ago
editor.scss
5 years ago
block.js
54 lines
| 1 | /** |
| 2 | * Block: Grid |
| 3 | */ |
| 4 | |
| 5 | import './editor.scss'; |
| 6 | |
| 7 | import editGridContainer from './edit'; |
| 8 | import blockAttributes from './attributes'; |
| 9 | import getIcon from '../../utils/get-icon'; |
| 10 | import deprecated from './deprecated'; |
| 11 | |
| 12 | import { |
| 13 | __, |
| 14 | } from '@wordpress/i18n'; |
| 15 | |
| 16 | import { |
| 17 | registerBlockType, |
| 18 | } from '@wordpress/blocks'; |
| 19 | |
| 20 | import { |
| 21 | InnerBlocks, |
| 22 | } from '@wordpress/block-editor'; |
| 23 | |
| 24 | /** |
| 25 | * Register our Grid block. |
| 26 | * |
| 27 | * @param {string} name Block name. |
| 28 | * @param {Object} settings Block settings. |
| 29 | * @return {?WPBlock} The block, if it has been successfully |
| 30 | * registered; otherwise `undefined`. |
| 31 | */ |
| 32 | registerBlockType( 'generateblocks/grid', { |
| 33 | title: __( 'Grid', 'generateblocks' ), |
| 34 | description: __( 'Create advanced layouts with flexible grids.', 'generateblocks' ), |
| 35 | icon: getIcon( 'grid' ), |
| 36 | category: 'generateblocks', |
| 37 | keywords: [ |
| 38 | __( 'grid' ), |
| 39 | __( 'column' ), |
| 40 | __( 'generate' ), |
| 41 | ], |
| 42 | attributes: blockAttributes, |
| 43 | supports: { |
| 44 | className: false, |
| 45 | }, |
| 46 | edit: editGridContainer, |
| 47 | save: () => { |
| 48 | return ( |
| 49 | <InnerBlocks.Content /> |
| 50 | ); |
| 51 | }, |
| 52 | deprecated, |
| 53 | } ); |
| 54 |