PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.0.0
GenerateBlocks v2.0.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 / container / components / BlockControls.js
generateblocks / src / blocks / container / components Last commit date
BlockAppender.js 3 years ago BlockControls.js 2 years ago ComponentCSS.js 1 year ago ContainerContentRenderer.js 2 years ago GridItem.js 4 years ago InspectorAdvancedControls.js 2 years ago LegacyLayoutControls.js 3 years ago ShapeDividers.js 4 years ago TagName.js 3 years ago
BlockControls.js
58 lines
1 import { AlignmentToolbar, BlockControls } from '@wordpress/block-editor';
2 import getAttribute from '../../../utils/get-attribute';
3 import typographyOptions from '../../../extend/inspector-control/controls/typography/options';
4 import getDeviceType from '../../../utils/get-device-type';
5 import AlignmentMatrixControl from '../../../extend/block-controls/controls/alignment-matrix-control';
6
7 export default ( { attributes, setAttributes } ) => {
8 const deviceType = getDeviceType();
9 const {
10 display,
11 displayTablet,
12 displayMobile,
13 flexDirection,
14 flexDirectionTablet,
15 flexDirectionMobile,
16 alignItems,
17 alignItemsTablet,
18 alignItemsMobile,
19 justifyContent,
20 justifyContentTablet,
21 justifyContentMobile,
22 } = attributes;
23
24 return (
25 <BlockControls group="block">
26 <AlignmentToolbar
27 value={ getAttribute( 'textAlign', { attributes: attributes.typography, deviceType } ) }
28 onChange={ ( value ) => {
29 setAttributes( {
30 typography: {
31 [ getAttribute( 'textAlign', { attributes: attributes.typography, deviceType }, true ) ]: value,
32 },
33 } );
34 } }
35 alignmentControls={ typographyOptions.alignments }
36 />
37
38 <AlignmentMatrixControl
39 attributes={ {
40 display,
41 displayTablet,
42 displayMobile,
43 flexDirection,
44 flexDirectionTablet,
45 flexDirectionMobile,
46 alignItems,
47 alignItemsTablet,
48 alignItemsMobile,
49 justifyContent,
50 justifyContentTablet,
51 justifyContentMobile,
52 } }
53 setAttributes={ setAttributes }
54 />
55 </BlockControls>
56 );
57 };
58