最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Double container elements on custom block in editor

programmeradmin2浏览0评论

The custom block I have created gets duplicate container elements in the editor. And the custom classes I set only gets applied to the inner container. On the front end the block output is as expected.

I've found one other thread on github about this, but it didn't have a solution.

blocks.registerBlockType( 'my-custom-blocks/section', {
        title: 'Section',
        category: 'design',
 
        edit: function () {
            var blockProps = useBlockProps({
                className: 'section'
            });
 
            return el(
                'section',
                blockProps,
                el(
                    InnerBlocks,
                    {
                        template: SECTION_TEMPLATE,
                        allowedBlocks: [
                            'my-custom-blocks/row'
                        ]
                    }
                )
            );
        },
 
        save: function () {
            var blockProps = useBlockProps.save({
                className: 'section'
            });
 
            return el( 'section', blockProps, el( InnerBlocks.Content ) );
        },
    } );

发布评论

评论列表(0)

  1. 暂无评论