PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.8
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / src / blocks / taxonomy / edit.js

edit.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at src/blocks/taxonomy/edit.js

62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useEffect, useMemo } from "@wordpress/element";
2 import { jsonStringify } from "../shared/helpFn";
3 import { useBlockProps } from "@wordpress/block-editor";
4 import { InspectorControl } from "../../components";
5 import Inspector from "./inspect";
6 import { TogglePanelBodyProvider } from "../../context";
7 import { panelBodyRightIcon, panelBodyTitleIcon } from "../../icons/icons";
8 import Render from "./Render";
9 import dynamicCssFn from "./dynamicCss";
10 import { googleFonts, useDeviceType } from "../../controls/controls";
11 import { compose } from "@wordpress/compose";
12 import addInitialAttr from "../shared/addInitialAttr";
13 const TaxonomyEdit = ({ attributes, setAttributes }) => {
14 const currentDevice = useDeviceType();
15 const blockProps = useBlockProps();
16 const { blockName, uniqueId, additionalCssClass, equalHeightEnable, titleTypography, fontListsEditPage } =
17 attributes;
18
19 const blockStyling = useMemo(
20 () => dynamicCssFn(attributes, "frontend", currentDevice),
21 [attributes, currentDevice]
22 );
23
24 const googleFontLists = [titleTypography];
25
26 useEffect(() => {
27 setAttributes({
28 fontLists: jsonStringify(googleFonts(googleFontLists, "frontend")),
29 fontListsEditPage: googleFonts(googleFontLists),
30 });
31 }, googleFontLists);
32
33 return (
34 <div {...blockProps}>
35 <style>
36 {fontListsEditPage}
37 {blockStyling}
38 </style>
39 <TogglePanelBodyProvider>
40 <InspectorControl
41 TitleIcon={panelBodyTitleIcon}
42 RightIcon={panelBodyRightIcon}
43 attributes={attributes}
44 setAttributes={setAttributes}
45 Inspector={Inspector}
46 />
47
48 <div
49 id={uniqueId}
50 className={`sp-smart-post-wrapper ${additionalCssClass} sp-smart-${blockName}-editor-page sp-smart-post-${blockName} ${
51 equalHeightEnable ? "sp-smart-post-show-equal-height" : ""
52 }`}
53 >
54 <Render attributes={attributes} />
55 </div>
56 </TogglePanelBodyProvider>
57 </div>
58 );
59 };
60
61 export default compose(addInitialAttr)(TaxonomyEdit);
62