Created
November 27, 2019 09:28
-
-
Save Tepluypled/2c2baf04a23723352174458c9fe347f3 to your computer and use it in GitHub Desktop.
Part1
This file contains 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
registerBlockType('namespace/block-slug', { | |
//built-in attributes | |
title: 'The name', | |
description: 'Block to generate a custom event', | |
icon: 'format-image', | |
category: 'layout' | |
//custom attributes | |
attributes: { | |
content: {type: 'string'} | |
}, | |
//custom functions | |
//built-in functions | |
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() {} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you forget to put a comma after this line