cleanup allowed_blocks logic and add mechanism for disabling blade template for specific block
This commit is contained in:
41
resources/views/blocks/article/index.jsx
Normal file
41
resources/views/blocks/article/index.jsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import { registerBlockType } from '@wordpress/blocks';
|
||||
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
|
||||
import metadata from './block.json';
|
||||
import allowedBlocks from '../../../json/core-block-whitelist.json';
|
||||
|
||||
registerBlockType(metadata.name, {
|
||||
icon: {
|
||||
src: 'format-aside',
|
||||
foreground: '#f58762',
|
||||
},
|
||||
edit({ attributes, setAttributes }) {
|
||||
const blockProps = useBlockProps();
|
||||
|
||||
return (
|
||||
<section { ...blockProps }>
|
||||
<div className="container">
|
||||
<InnerBlocks
|
||||
allowedBlocks={ allowedBlocks }
|
||||
defaultBlock={
|
||||
{
|
||||
name: "core/paragraph",
|
||||
attributes: {
|
||||
placeholder: "start typing",
|
||||
}
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
},
|
||||
save() {
|
||||
return (
|
||||
<section { ...useBlockProps.save() }>
|
||||
<div className="container">
|
||||
<InnerBlocks.Content />
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user