# learnpress/4.1.7.3/assets/src/apps/js/blocks/template/edit.js

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.1.7.3. 43 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.1.7.3/code/assets/src/apps/js/blocks/template/edit.js
- Raw: https://pluginprobe.com/plugins/learnpress/4.1.7.3/raw/assets/src/apps/js/blocks/template/edit.js
- Modified: 2022-11-02T07:32:08+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/learnpress/4.1.7.3/code/assets/src/apps/js/blocks/template/edit.js#L10-L20`.

```javascript

import { useBlockProps } from '@wordpress/block-editor';
import { Placeholder } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { page } from '@wordpress/icons';

const TEMPLATES = {
	'single-course': {
		title: __( 'LearnPress Single Course Template', 'learnpress' ),
		placeholder: 'single-course',
	},
	'archive-course': {
		title: __( 'LearnPress Course Archive Template', 'learnpress' ),
		placeholder: 'archive-course',
	},
};

export default function Edit( { attributes } ) {
	const blockProps = useBlockProps();
	const templateTitle = TEMPLATES[ attributes.template ]?.title ?? attributes.template;

	return (
		<div { ...blockProps }>
			<Placeholder
				icon={ page }
				label={ templateTitle }
				className="wp-block-learnpress-template__placeholder"
			>
				<div className="wp-block-learnpress-template__placeholder-inner">
					{ sprintf(
						/* translators: %s is the template title */
						__(
							'This is an editor placeholder for the %s. This will be replaced by the template in your store and displayed with your course image(s), title, price, and so on. You can move this placeholder around and add further blocks around it to extend the template.',
							'learnpress'
						),
						templateTitle
					) }
				</div>
			</Placeholder>
		</div>
	);
}

```
