forked from nylen/gutenberg-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.js
37 lines (36 loc) · 914 Bytes
/
block.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Hello World: Step 2
*
* Move styles to stylesheets - both edit and front-end.
*
* Note the `className` property supplied to the `edit` callback. To use the
* `.wp-block-*` class for styling, plugin implementers must return an
* appropriate element with this class.
*/
( function( blocks, i18n, element ) {
var el = element.createElement;
var __ = i18n.__;
blocks.registerBlockType( 'gutenberg-boilerplate-es5/hello-world-step-02', {
title: __( 'Hello World (step 2)', 'gutenberg-boilerplate-es5' ),
icon: 'universal-access-alt',
category: 'layout',
edit: function( props ) {
return el(
'p',
{ className: props.className },
'Hello World, step 2 (from the editor, in green).'
);
},
save: function() {
return el(
'p',
{},
'Hello World, step 2 (from the frontend, in red).'
);
},
} );
} )(
window.wp.blocks,
window.wp.i18n,
window.wp.element
);