PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.1
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.1
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / form / fields / textarea / edit.js

edit.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.4.1, at gutenberg/blocks/form/fields/textarea/edit.js

65 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import classnames from 'classnames/dedupe';
2
3 import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
4 import { PanelBody, TextareaControl } from '@wordpress/components';
5 import { applyFilters } from '@wordpress/hooks';
6 import { __ } from '@wordpress/i18n';
7
8 import {
9 FieldDefaultSettings,
10 getFieldAttributes,
11 } from '../../field-attributes';
12 import FieldDescription from '../../field-description';
13 import FieldLabel from '../../field-label';
14
15 /**
16 * Block Edit Class.
17 *
18 * @param props
19 */
20 export default function BlockEdit(props) {
21 const { attributes, setAttributes } = props;
22
23 const { default: defaultVal } = attributes;
24
25 let { className = '' } = props;
26
27 className = classnames(
28 'ghostkit-form-field ghostkit-form-field-textarea',
29 className
30 );
31 className = applyFilters('ghostkit.editor.className', className, props);
32
33 const defaultCustom = (
34 <TextareaControl
35 label={__('Default', 'ghostkit')}
36 value={defaultVal}
37 onChange={(val) => setAttributes({ default: val })}
38 __nextHasNoMarginBottom
39 />
40 );
41
42 const blockProps = useBlockProps({ className });
43
44 return (
45 <>
46 <InspectorControls>
47 <PanelBody>
48 <FieldDefaultSettings
49 {...props}
50 defaultCustom={defaultCustom}
51 />
52 </PanelBody>
53 </InspectorControls>
54 <div {...blockProps}>
55 <FieldLabel {...props} />
56 <TextareaControl
57 __nextHasNoMarginBottom
58 {...getFieldAttributes(attributes)}
59 />
60 <FieldDescription {...props} />
61 </div>
62 </>
63 );
64 }
65