Created
August 21, 2019 14:17
-
-
Save Shininglow/e11de5758501f53c8b91c88f642cedac to your computer and use it in GitHub Desktop.
extra gutenberg block js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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