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 |