How to add a Gutenberg RichText into other block in Wordpress?

28 Views Asked by At

By example, have a custom block with a title and RichText content, how to add the RichText block as element into my block?.

My JS code is:

wp.blocks.registerBlockType('custom-block/wrapped-content', {
    title: 'Wrapped content',
    icon: 'editor-textcolor',
    category: 'common',
    attributes: {
        content: { type: 'array' }
    },
    edit: (props) => {
        return wp.element.createElement('div',
            {
                class: 'wrapped container border rounded p-2'
            },
            wp.element.createElement(/* RichText here! */)
        );
    },
    save: (props) => { }
});
0

There are 0 best solutions below