# post-carousel/4.0.2/src/blocks/shortcode/edit.js

Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog &amp; News, version 4.0.2. 60 lines.

- Page: https://pluginprobe.com/plugins/post-carousel/4.0.2/code/src/blocks/shortcode/edit.js
- Raw: https://pluginprobe.com/plugins/post-carousel/4.0.2/raw/src/blocks/shortcode/edit.js
- Modified: 2026-04-24T11:48:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/post-carousel/4.0.2/code/src/blocks/shortcode/edit.js#L10-L20`.

```javascript
import { __ } from "@wordpress/i18n";
import { useBlockProps } from "@wordpress/block-editor";
import DynamicShortcodeInput from "./dynamicShortcode";
import { ShortCodeBlockIcon } from "./blockIcon";
import "./editor.scss";

const Edit = ({ attributes, setAttributes }) => {
	const shortCodeList = smartPostShowGbScript.shortCodeList;

	const blockProps = useBlockProps();


	const updateShortcode = (e) => {
		setAttributes({ shortcode: e.target.value });
	};

	const shortcodeUpdate = (e) => {
		updateShortcode(e);
	};


	if (shortCodeList.length === 0) {
		return (
			<div {...blockProps}>
				<div className="spsp_block_shortcode components-placeholder">
					<div className="components-placeholder__label">
						<ShortCodeBlockIcon />
						{__("Smart Post", "post-carousel")}
					</div>
					<p className="spsp_block_shortcode_text">
						{__("No shortcode found.", "post-carousel")}
						<a href={smartPostShowGbScript.link}>{__("Create a shortcode now!", "post-carousel")}</a>
					</p>
				</div>
			</div>
		);
	}

	return (
		<div {...blockProps}>
			<div className="components-placeholder is-large">
				<div className="components-placeholder__label">
					<ShortCodeBlockIcon />
					{__("Smart Post", "post-carousel")}
				</div>
				<div className="components-placeholder__instructions">
					{__("Select a Show", "post-carousel")}
				</div>
				<DynamicShortcodeInput
					attributes={attributes}
					shortCodeList={shortCodeList}
					shortcodeUpdate={shortcodeUpdate}
				/>
			</div>
		</div>
	);
};

export default Edit;

```
