-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.js
35 lines (34 loc) · 1.11 KB
/
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
(function (blocks, element) {
var el = element.createElement;
blocks.registerBlockType('custom/instructions-block', {
title: 'Instructions Block',
icon: 'admin-comments',
category: 'common',
edit: function (props) {
return el(
'div',
{ className: 'instructions-block' },
el('h3', {}, 'Reminders from James'),
el('p', {}, 'Note: This reminder will not show on the frontend'),
el('textarea', {
value: props.attributes.content,
onChange: function (event) {
props.setAttributes({ content: event.target.value });
},
placeholder: 'Enter your instructions here...'
})
);
},
save: function (props) {
return el('div', { style: { display: 'none' } }, props.attributes.content);
},
attributes: {
content: {
type: 'string',
},
},
});
})(
window.wp.blocks,
window.wp.element
);