guten.js 577 B

123456789101112131415161718192021222324252627282930313233
  1. registerBlockType('my-plugin/event-location', {
  2. title: 'Media URL',
  3. category: 'widgets',
  4. attributes: {
  5. location: {
  6. type: 'string',
  7. source: 'meta',
  8. meta: 'media_url'
  9. }
  10. },
  11. edit ({ className, attributes, setAttributes }) {
  12. const { location } = attributes
  13. function updateContent (e) {
  14. setAttributes({ location: e.target.value })
  15. }
  16. return el(
  17. 'p',
  18. { className: className },
  19. el(
  20. 'input',
  21. { value: location, onChange: updateContent }
  22. )
  23. )
  24. },
  25. save () {
  26. return null
  27. }
  28. })