| 1 |
import classnames from 'classnames/dedupe'; |
| 2 |
|
| 3 |
import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; |
| 4 |
import { PanelBody, TextControl } from '@wordpress/components'; |
| 5 |
import { applyFilters } from '@wordpress/hooks'; |
| 6 |
|
| 7 |
import { |
| 8 |
FieldDefaultSettings, |
| 9 |
getFieldAttributes, |
| 10 |
} from '../../field-attributes'; |
| 11 |
import FieldDescription from '../../field-description'; |
| 12 |
import FieldLabel from '../../field-label'; |
| 13 |
|
| 14 |
/** |
| 15 |
* Block Edit Class. |
| 16 |
* |
| 17 |
* @param props |
| 18 |
*/ |
| 19 |
export default function BlockEdit(props) { |
| 20 |
const { attributes } = props; |
| 21 |
|
| 22 |
let { className = '' } = props; |
| 23 |
|
| 24 |
className = classnames( |
| 25 |
'ghostkit-form-field ghostkit-form-field-phone', |
| 26 |
className |
| 27 |
); |
| 28 |
className = applyFilters('ghostkit.editor.className', className, props); |
| 29 |
|
| 30 |
const blockProps = useBlockProps({ className }); |
| 31 |
|
| 32 |
return ( |
| 33 |
<> |
| 34 |
<InspectorControls> |
| 35 |
<PanelBody> |
| 36 |
<FieldDefaultSettings {...props} /> |
| 37 |
</PanelBody> |
| 38 |
</InspectorControls> |
| 39 |
<div {...blockProps}> |
| 40 |
<FieldLabel {...props} /> |
| 41 |
<TextControl type="tel" {...getFieldAttributes(attributes)} /> |
| 42 |
<FieldDescription {...props} /> |
| 43 |
</div> |
| 44 |
</> |
| 45 |
); |
| 46 |
} |
| 47 |
|