-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Expand file tree
/
Copy pathregister.js
More file actions
39 lines (39 loc) · 821 Bytes
/
register.js
File metadata and controls
39 lines (39 loc) · 821 Bytes
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
38
39
window.wp.blocks.registerBlock( {
name: 'paragraph',
displayName: 'Paragraph',
elements: [ 'p' ],
type: 'text',
icon: 'gridicons-posts',
controls: [
{
icon: 'gridicons-heading',
onClick: function( block, editor ) {
editor.formatter.apply( 'h1' );
}
},
{
icon: 'gridicons-quote',
onClick: function( block, editor ) {
editor.formatter.apply( 'blockquote' );
}
},
{
icon: 'gridicons-list-unordered',
onClick: function( block, editor ) {
editor.execCommand( 'InsertUnorderedList' );
}
},
{
icon: 'gridicons-code',
onClick: function( block, editor ) {
editor.formatter.apply( 'pre' );
}
},
'text-align-left',
'text-align-center',
'text-align-right'
],
insert: function( block, editor ) {
editor.formatter.apply( 'paragraph', block );
}
} );