Skip to content

Instantly share code, notes, and snippets.

@Shininglow

Shininglow/extra.js

Created Aug 21, 2019
Embed
What would you like to do?
extra gutenberg block js
wp.blocks.registerBlockType('my_new-block', {
title: 'My Extra Block',
icon: 'heart',
category: 'common',
attributes: {
content: {type: 'string'}
},
edit: function(props) {
function somename(event) {
props.setAttributes({content: event.target.value})
}
return wp.element.createElement(
"div",
null,
wp.element.createElement(
"h3",
null,
"Enter your sample text"
),
wp.element.createElement("input", { type: "text", value: props.attributes.content, onChange: somename })
);
},
save: function(props) {
return null
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.