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 / components / editor-styles / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/components/editor-styles/index.js

38 lines 682 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { compact, map } from 'lodash';
2
3 import { transformStyles } from '@wordpress/block-editor';
4 import { useMemo } from '@wordpress/element';
5
6 const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper';
7
8 export default function EditorStyles(props) {
9 const { styles } = props;
10
11 const renderStyles = useMemo(() => {
12 const transformedStyles = transformStyles(
13 [
14 {
15 css: styles,
16 },
17 ],
18 EDITOR_STYLES_SELECTOR
19 );
20
21 let resultStyles = '';
22
23 map(compact(transformedStyles), (updatedCSS) => {
24 resultStyles += updatedCSS;
25 });
26
27 return resultStyles;
28 }, [styles]);
29
30 return (
31 <style
32 dangerouslySetInnerHTML={{
33 __html: renderStyles,
34 }}
35 />
36 );
37 }
38