I use Gutenberg with WordPress.
I'm trying to use example property to show an image in the block preview area. But I got a preview of a block itself (this is not my image but how the field is in the editor).
What's wrong please ? Can I have some help ?
registerBlockType( 'ccn/gut-text-title', {
apiVersion: 2,
title: __( 'Titre', 'ccn-gut' ),
category: 'text',
icon: blockIcons.text_title,
keywords: [ __( 'titre', 'ccn-gut' ) ],
attributes: {
content: {
type: 'string',
source: 'html',
selector: '.gut-hook-text'
},
},
example: {
attributes: {
cover: 'https://image.shutterstock.com/image-vector/example-sign-paper-origami-speech-260nw-1164503347.jpg',
},
},
edit: Edit,
save,
} )
I tried with basics attributes. Same result...
example: {
attributes: {
backgroundColor: '#000000',
textColor: '#FFFFFF',
title: __( 'I am a test', 'ccn-gut' ),
},
},
I Tried with code sample example too :
example: {
attributes: {
cover: 'https://image.shutterstock.com/image-vector/example-sign-paper-origami-speech-260nw-1164503347.jpg',
},
innerBlocks: [
{
name: 'core/paragraph',
attributes: {
content: __(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.'
),
},
},
],
},
I followed this tutorial without any success : https://mediaron.com/how-to-enable-gutenberg-block-previews/

