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 / extend / position / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.3, at gutenberg/extend/position/index.js

81 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import './position';
2 import './distance';
3 import './width';
4 import './height';
5 import './minMaxWidth';
6 import './minMaxHeight';
7 import './zIndex';
8
9 import { InspectorControls } from '@wordpress/block-editor';
10 import { hasBlockSupport } from '@wordpress/blocks';
11 import {
12 __experimentalToolsPanel as ExperimentalToolsPanel,
13 __stableToolsPanel as StableToolsPanel,
14 } from '@wordpress/components';
15 import { addFilter } from '@wordpress/hooks';
16 import { __ } from '@wordpress/i18n';
17
18 import ApplyFilters from '../../components/apply-filters';
19 import useStyles from '../../hooks/use-styles';
20 import getIcon from '../../utils/get-icon';
21 import { EXTENSIONS } from '../constants';
22
23 const ToolsPanel = StableToolsPanel || ExperimentalToolsPanel;
24
25 const allPositionProps = EXTENSIONS.position.styles;
26
27 /**
28 * Add inspector controls.
29 *
30 * @param original
31 * @param root0
32 * @param root0.props
33 */
34 function GhostKitExtensionPositionInspector(original, { props }) {
35 const { name } = props;
36
37 const hasPositionSupport = hasBlockSupport(name, ['ghostkit', 'position']);
38
39 if (!hasPositionSupport) {
40 return original;
41 }
42
43 const { resetStyles } = useStyles(props);
44
45 return (
46 <>
47 {original}
48 <InspectorControls group="styles">
49 <ToolsPanel
50 label={
51 <>
52 <span className="ghostkit-ext-icon">
53 {getIcon('extension-position')}
54 </span>
55 <span>{__('Position', 'ghostkit')}</span>
56 </>
57 }
58 resetAll={() => {
59 resetStyles(allPositionProps, true);
60 }}
61 >
62 <div className="ghostkit-tools-panel-position">
63 <ApplyFilters
64 name="ghostkit.extension.position.tools"
65 props={props}
66 />
67 </div>
68 </ToolsPanel>
69 </InspectorControls>
70 </>
71 );
72 }
73
74 // Init filters.
75 addFilter(
76 'ghostkit.editor.extensions',
77 'ghostkit/extension/position/inspector',
78 GhostKitExtensionPositionInspector,
79 12
80 );
81