PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.8.3
GenerateBlocks v1.8.3
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 / headline / components / InspectorAdvancedControls.js
generateblocks / src / blocks / headline / components Last commit date
BlockControls.js 2 years ago ComponentCSS.js 4 years ago HeadlineContentRenderer.js 3 years ago InspectorAdvancedControls.js 3 years ago TagName.js 3 years ago ToolbarGroup.js 4 years ago
InspectorAdvancedControls.js
45 lines
1 import { InspectorAdvancedControls } from '@wordpress/block-editor';
2 import HTMLAnchor from '../../../components/html-anchor';
3 import TagName from './TagName';
4
5 export default ( props ) => {
6 const {
7 attributes,
8 setAttributes,
9 } = props;
10
11 const {
12 isCaption,
13 element,
14 marginTop,
15 marginRight,
16 marginBottom,
17 marginLeft,
18 marginUnit,
19 } = attributes;
20
21 return (
22 <InspectorAdvancedControls>
23 <HTMLAnchor { ...props } />
24
25 <TagName
26 isCaption={ isCaption }
27 tagName={ element }
28 onChange={ ( value ) => {
29 setAttributes( {
30 element: value,
31 } );
32
33 if ( ! marginTop && ! marginRight && ! marginBottom && ! marginLeft ) {
34 if ( 'p' === value ) {
35 setAttributes( { marginUnit: 'em' } );
36 } else {
37 setAttributes( { marginUnit } );
38 }
39 }
40 } }
41 />
42 </InspectorAdvancedControls>
43 );
44 };
45