PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.3
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.3
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.3.3, at gutenberg/blocks/form/fields/textarea/edit.js

61 lines 1.4 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 />
39 );
40
41 const blockProps = useBlockProps({ className });
42
43 return (
44 <>
45 <InspectorControls>
46 <PanelBody>
47 <FieldDefaultSettings
48 {...props}
49 defaultCustom={defaultCustom}
50 />
51 </PanelBody>
52 </InspectorControls>
53 <div {...blockProps}>
54 <FieldLabel {...props} />
55 <TextareaControl {...getFieldAttributes(attributes)} />
56 <FieldDescription {...props} />
57 </div>
58 </>
59 );
60 }
61