PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
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 / widgetized-area / edit.js

edit.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/blocks/widgetized-area/edit.js

60 lines 1.3 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 { useBlockProps } from '@wordpress/block-editor';
4 import { Placeholder, SelectControl } from '@wordpress/components';
5 import { __ } from '@wordpress/i18n';
6
7 import getIcon from '../../utils/get-icon';
8
9 const { GHOSTKIT } = window;
10
11 /**
12 * Block Edit Class.
13 *
14 * @param props
15 */
16 export default function BlockEdit(props) {
17 const { setAttributes, attributes } = props;
18
19 let { className } = props;
20
21 const { id } = attributes;
22
23 className = classnames('ghostkit-widgetized-area', className);
24
25 const blockProps = useBlockProps({ className });
26
27 return (
28 <div {...blockProps}>
29 <Placeholder
30 icon={getIcon('block-widgetized-area')}
31 label={__('Widgetized Area', 'ghostkit')}
32 >
33 <SelectControl
34 value={id}
35 onChange={(value) => setAttributes({ id: value })}
36 options={(() => {
37 const sidebars = [
38 {
39 label: __('--- Select Sidebar ---', 'ghostkit'),
40 value: '',
41 },
42 ];
43
44 if (GHOSTKIT.sidebars) {
45 Object.keys(GHOSTKIT.sidebars).forEach((k) => {
46 sidebars.push({
47 label: GHOSTKIT.sidebars[k].name,
48 value: GHOSTKIT.sidebars[k].id,
49 });
50 });
51 }
52
53 return sidebars;
54 })()}
55 />
56 </Placeholder>
57 </div>
58 );
59 }
60