File "InspectorAdvancedControls.js"

Full path: /home/webcknlt/admissiontell.com/wp-content/plugins/generateblocks/src/blocks/headline/components/InspectorAdvancedControls.js
File size: 862 B (862 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

import { InspectorAdvancedControls } from '@wordpress/block-editor';
import HTMLAnchor from '../../../components/html-anchor';
import TagName from './TagName';

export default ( props ) => {
	const {
		attributes,
		setAttributes,
	} = props;

	const {
		isCaption,
		element,
		marginTop,
		marginRight,
		marginBottom,
		marginLeft,
		marginUnit,
	} = attributes;

	return (
		<InspectorAdvancedControls>
			<HTMLAnchor { ...props } />

			<TagName
				isCaption={ isCaption }
				tagName={ element }
				onChange={ ( value ) => {
					setAttributes( {
						element: value,
					} );

					if ( ! marginTop && ! marginRight && ! marginBottom && ! marginLeft ) {
						if ( 'p' === value ) {
							setAttributes( { marginUnit: 'em' } );
						} else {
							setAttributes( { marginUnit } );
						}
					}
				} }
			/>
		</InspectorAdvancedControls>
	);
};