| 1 |
import { RichText } from '@wordpress/block-editor'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
/** |
| 5 |
* Field Description Class. |
| 6 |
* |
| 7 |
* @param props |
| 8 |
*/ |
| 9 |
export default function FieldDescription(props) { |
| 10 |
const { attributes, setAttributes, isSelected } = props; |
| 11 |
|
| 12 |
const { description, hideDescription } = attributes; |
| 13 |
|
| 14 |
if (!description && !isSelected) { |
| 15 |
return null; |
| 16 |
} |
| 17 |
|
| 18 |
if (hideDescription && !isSelected) { |
| 19 |
return null; |
| 20 |
} |
| 21 |
|
| 22 |
return ( |
| 23 |
<RichText |
| 24 |
inlineToolbar |
| 25 |
tagName="small" |
| 26 |
className="ghostkit-form-field-description" |
| 27 |
value={description} |
| 28 |
placeholder={__('Write description…', 'ghostkit')} |
| 29 |
onChange={(val) => setAttributes({ description: val })} |
| 30 |
/> |
| 31 |
); |
| 32 |
} |
| 33 |
|