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 / custom-css / index.js

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

84 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import './opacity';
2 import './overflow';
3 import './cursor';
4 import './userSelect';
5 import './clipPath';
6 import './pro-transition';
7 import './custom';
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 allCustomCSS = EXTENSIONS.customCSS.styles;
26
27 /**
28 * Add inspector controls.
29 *
30 * @param original
31 * @param root0
32 * @param root0.props
33 */
34 function GhostKitExtensionCustomCSSInspector(original, { props }) {
35 const { name } = props;
36
37 const hasCustomCSSSupport = hasBlockSupport(name, [
38 'ghostkit',
39 'customCSS',
40 ]);
41
42 if (!hasCustomCSSSupport) {
43 return original;
44 }
45
46 const { resetStyles } = useStyles(props);
47
48 return (
49 <>
50 {original}
51 <InspectorControls group="styles">
52 <ToolsPanel
53 label={
54 <>
55 <span className="ghostkit-ext-icon">
56 {getIcon('extension-custom-css')}
57 </span>
58 <span>{__('Custom CSS', 'ghostkit')}</span>
59 </>
60 }
61 resetAll={() => {
62 resetStyles(allCustomCSS, true);
63 }}
64 >
65 <div className="ghostkit-tools-panel-custom-css">
66 <ApplyFilters
67 name="ghostkit.extension.customCSS.tools"
68 props={props}
69 />
70 </div>
71 </ToolsPanel>
72 </InspectorControls>
73 </>
74 );
75 }
76
77 // Init filters.
78 addFilter(
79 'ghostkit.editor.extensions',
80 'ghostkit/extension/customCSS/inspector',
81 GhostKitExtensionCustomCSSInspector,
82 16
83 );
84