| 1 |
/** |
| 2 |
* External dependencies |
| 3 |
*/ |
| 4 |
import classnames from 'classnames/dedupe'; |
| 5 |
|
| 6 |
/** |
| 7 |
* Internal dependencies |
| 8 |
*/ |
| 9 |
import FieldLabel from '../../field-label'; |
| 10 |
import FieldDescription from '../../field-description'; |
| 11 |
import { getFieldAttributes, FieldDefaultSettings } from '../../field-attributes'; |
| 12 |
|
| 13 |
/** |
| 14 |
* WordPress dependencies |
| 15 |
*/ |
| 16 |
const { applyFilters } = wp.hooks; |
| 17 |
|
| 18 |
const { Component, Fragment } = wp.element; |
| 19 |
|
| 20 |
const { PanelBody, TextControl } = wp.components; |
| 21 |
|
| 22 |
const { InspectorControls } = wp.blockEditor; |
| 23 |
|
| 24 |
/** |
| 25 |
* Block Edit Class. |
| 26 |
*/ |
| 27 |
class BlockEdit extends Component { |
| 28 |
render() { |
| 29 |
const { attributes } = this.props; |
| 30 |
|
| 31 |
let { className = '' } = this.props; |
| 32 |
|
| 33 |
className = classnames('ghostkit-form-field ghostkit-form-field-phone', className); |
| 34 |
|
| 35 |
className = applyFilters('ghostkit.editor.className', className, this.props); |
| 36 |
|
| 37 |
return ( |
| 38 |
<Fragment> |
| 39 |
<InspectorControls> |
| 40 |
<PanelBody> |
| 41 |
<FieldDefaultSettings {...this.props} /> |
| 42 |
</PanelBody> |
| 43 |
</InspectorControls> |
| 44 |
<div className={className}> |
| 45 |
<FieldLabel {...this.props} /> |
| 46 |
<TextControl type="tel" {...getFieldAttributes(attributes)} /> |
| 47 |
<FieldDescription {...this.props} /> |
| 48 |
</div> |
| 49 |
</Fragment> |
| 50 |
); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
export default BlockEdit; |
| 55 |
|