Browse Source

guten.js for video_meta

windhamdavid 5 years ago
parent
commit
9aeb9d274e
1 changed files with 33 additions and 0 deletions
  1. 33 0
      js/guten.js

+ 33 - 0
js/guten.js

@@ -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
+  }
+})