Changes to blocks
This commit is contained in:
@ -11,7 +11,7 @@ import { __ } from '@wordpress/i18n';
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
|
||||
*/
|
||||
import { useBlockProps, InnerBlocks} from '@wordpress/block-editor';
|
||||
import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
|
||||
|
||||
/**
|
||||
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
|
||||
@ -30,15 +30,23 @@ import './editor.scss';
|
||||
* @return {Element} Element to render.
|
||||
*/
|
||||
export default function Edit() {
|
||||
return (<div>
|
||||
<p { ...useBlockProps() }>
|
||||
{ __( 'Lcp Sidecontent – hello from the editor!', 'lcp' ) }
|
||||
</p>
|
||||
<InnerBlocks
|
||||
// Optional: You can provide a template or allowed blocks
|
||||
// template={[['core/paragraph'], ['core/image']]}
|
||||
// Block props
|
||||
const blockProps = useBlockProps();
|
||||
|
||||
/>
|
||||
// Custom appender logic (you can customize this as needed)
|
||||
const renderAppender = () => {
|
||||
return <InnerBlocks.ButtonBlockAppender />;
|
||||
};
|
||||
|
||||
return (
|
||||
<div {...useBlockProps}>
|
||||
<div id="lcp-sidecontent">
|
||||
<InnerBlocks
|
||||
// Optional: You can provide a template or allowed blocks
|
||||
// template={[['core/paragraph'], ['core/image']]}
|
||||
renderAppender={renderAppender} // Add the custom appender here
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user