Enhancing Gutenberg featured image control

Question

I’m wanting to add some functionality to the featured image block in the Gutenberg editor. There are a handful of posts online about how to do this, including a question/answer here (3rd item).

Unfortunately, I’m missing something somewhere because I can’t get even the basics to work for me. I’ve got javascript that verifiably loads on the post type edit page as follows:

window.addEventListener("load", function(event){
  console.log("featured_image.js loaded and functional...");
});

var el = wp.element.createElement;

function wrapPostFeaturedImage( OriginalComponent ) {
  return function( props ) {
      return (
          el(
              wp.element.Fragment,
              {},
              'Prepend above',
              el(
                  OriginalComponent,
                  props
              ),
              'Append below'
          )
      );
  }
}

wp.hooks.addFilter(
  'editor.PostFeaturedImage',
  'dsplugin/wrap-post-featured-image',
  wrapPostFeaturedImage
);

But the above is having no effect on the featured image box. I’m new to Gutenberg so I’m probably missing half a dozen things. If someone could point me in the right direction, I’d be grateful.

0
Andrew 4 years 2020-03-11T00:52:14-05:00 0 Answers 125 views 0

Leave an answer

Browse
Browse