/** * External dependencies */ import { createBlock, registerBlockType } from '@wordpress/blocks'; import { isExperimentalBuild, WC_BLOCKS_IMAGE_URL, } from '@woocommerce/block-settings'; import { useBlockProps } from '@wordpress/block-editor'; import { Button, Placeholder } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { box, Icon } from '@wordpress/icons'; import { useDispatch } from '@wordpress/data'; /** * Internal dependencies */ import './editor.scss'; import './style.scss'; import { TEMPLATES } from './constants'; interface Props { attributes: { template: string; align: string; }; clientId: string; } const Edit = ( { clientId, attributes }: Props ) => { const { replaceBlock } = useDispatch( 'core/block-editor' ); const blockProps = useBlockProps(); const templateTitle = TEMPLATES[ attributes.template ]?.title ?? attributes.template; const templatePlaceholder = TEMPLATES[ attributes.template ]?.placeholder ?? 'fallback'; return (
{ __( 'Attention: Do not remove this block!', 'woo-gutenberg-products-block' ) } { ' ' } { __( 'Removal will cause unintended effects on your store.', 'woo-gutenberg-products-block' ) }
{ sprintf( /* translators: %s is the template title */ __( 'This is an editor placeholder for the %s. On your store this will be replaced by the template and display with your product image(s), title, price, etc. You can move this placeholder around and add further blocks around it to extend the template.', 'woo-gutenberg-products-block' ), templateTitle ) }