PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.4
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.4
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 / shortcode / edit.js

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

60 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from "@wordpress/i18n";
2 import { useBlockProps } from "@wordpress/block-editor";
3 import DynamicShortcodeInput from "./dynamicShortcode";
4 import { ShortCodeBlockIcon } from "./blockIcon";
5 import "./editor.scss";
6
7 const Edit = ({ attributes, setAttributes }) => {
8 const shortCodeList = smartPostShowGbScript.shortCodeList;
9
10 const blockProps = useBlockProps();
11
12
13 const updateShortcode = (e) => {
14 setAttributes({ shortcode: e.target.value });
15 };
16
17 const shortcodeUpdate = (e) => {
18 updateShortcode(e);
19 };
20
21
22 if (shortCodeList.length === 0) {
23 return (
24 <div {...blockProps}>
25 <div className="spsp_block_shortcode components-placeholder">
26 <div className="components-placeholder__label">
27 <ShortCodeBlockIcon />
28 {__("Smart Post", "post-carousel")}
29 </div>
30 <p className="spsp_block_shortcode_text">
31 {__("No shortcode found.", "post-carousel")}
32 <a href={smartPostShowGbScript.link}>{__("Create a shortcode now!", "post-carousel")}</a>
33 </p>
34 </div>
35 </div>
36 );
37 }
38
39 return (
40 <div {...blockProps}>
41 <div className="components-placeholder is-large">
42 <div className="components-placeholder__label">
43 <ShortCodeBlockIcon />
44 {__("Smart Post", "post-carousel")}
45 </div>
46 <div className="components-placeholder__instructions">
47 {__("Select a Show", "post-carousel")}
48 </div>
49 <DynamicShortcodeInput
50 attributes={attributes}
51 shortCodeList={shortCodeList}
52 shortcodeUpdate={shortcodeUpdate}
53 />
54 </div>
55 </div>
56 );
57 };
58
59 export default Edit;
60