You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
wp.blocks.registerBlockType( 'movies/favorite-movie-quote', {
|
|
title: 'Favorite movie quote',
|
|
icon: 'format-quote',
|
|
category: 'common',
|
|
attributes: {
|
|
content: {
|
|
type: 'string',
|
|
selector: 'blockquote',
|
|
},
|
|
},
|
|
edit: function( props ) {
|
|
let attributes = props.attributes;
|
|
|
|
console.log(props.attributes);
|
|
|
|
function onChangeContent( value ) {
|
|
props.setAttributes( { content: value } );
|
|
}
|
|
|
|
return wp.element.createElement(
|
|
'blockquote',
|
|
null,
|
|
wp.element.createElement(
|
|
wp.components.TextControl,
|
|
{
|
|
value: attributes.content,
|
|
onChange: onChangeContent,
|
|
placeholder: 'Enter favorite movie quote',
|
|
}
|
|
)
|
|
);
|
|
},
|
|
save: function( props ) {
|
|
return wp.element.createElement(
|
|
'blockquote',
|
|
null,
|
|
props.attributes.content,
|
|
);
|
|
},
|
|
});
|