25 lines
906 B
Plaintext
25 lines
906 B
Plaintext
|
/**
|
||
|
* External dependencies
|
||
|
*/
|
||
|
import type { BlockAttributes } from '@wordpress/blocks';
|
||
|
import { useBlockProps } from '@wordpress/block-editor';
|
||
|
import { createElement } from '@wordpress/element';
|
||
|
|
||
|
/**
|
||
|
* The edit function describes the structure of your block in the context of the
|
||
|
* editor. This represents what the editor will render when the block is used.
|
||
|
*
|
||
|
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
|
||
|
*
|
||
|
*/
|
||
|
export function Edit( { attributes }: { attributes: BlockAttributes } ) {
|
||
|
/**
|
||
|
* React hook that is used to mark the block wrapper element.
|
||
|
* It provides all the necessary props like the class name.
|
||
|
*
|
||
|
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
|
||
|
*/
|
||
|
const blockProps = useBlockProps();
|
||
|
return <div { ...blockProps }>{ attributes.message }</div>;
|
||
|
}
|