|
@@ -0,0 +1,33 @@
|
|
|
|
+registerBlockType('my-plugin/event-location', {
|
|
|
|
+ title: 'Media URL',
|
|
|
|
+ category: 'widgets',
|
|
|
|
+
|
|
|
|
+ attributes: {
|
|
|
|
+ location: {
|
|
|
|
+ type: 'string',
|
|
|
|
+ source: 'meta',
|
|
|
|
+ meta: 'media_url'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ edit ({ className, attributes, setAttributes }) {
|
|
|
|
+ const { location } = attributes
|
|
|
|
+
|
|
|
|
+ function updateContent (e) {
|
|
|
|
+ setAttributes({ location: e.target.value })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return el(
|
|
|
|
+ 'p',
|
|
|
|
+ { className: className },
|
|
|
|
+ el(
|
|
|
|
+ 'input',
|
|
|
|
+ { value: location, onChange: updateContent }
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ save () {
|
|
|
|
+ return null
|
|
|
|
+ }
|
|
|
|
+})
|