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 / carousel-slide / edit.js

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

45 lines 1019 B
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 {
4 InnerBlocks,
5 useBlockProps,
6 useInnerBlocksProps,
7 } from '@wordpress/block-editor';
8 import { useSelect } from '@wordpress/data';
9 import { applyFilters } from '@wordpress/hooks';
10
11 /**
12 * Block Edit Class.
13 *
14 * @param props
15 */
16 export default function BlockEdit(props) {
17 const { attributes, clientId } = props;
18 let { className } = attributes;
19
20 const hasChildBlocks = useSelect(
21 (select) => {
22 const blockEditor = select('core/block-editor');
23
24 return blockEditor
25 ? blockEditor.getBlockOrder(clientId).length > 0
26 : false;
27 },
28 [clientId]
29 );
30
31 className = classnames(className, 'ghostkit-carousel-slide');
32
33 className = applyFilters('ghostkit.editor.className', className, props);
34
35 const blockProps = useBlockProps({ className });
36 const innerBlockProps = useInnerBlocksProps(blockProps, {
37 renderAppender: hasChildBlocks
38 ? undefined
39 : InnerBlocks.ButtonBlockAppender,
40 templateLock: false,
41 });
42
43 return <div {...innerBlockProps} />;
44 }
45