Enhancing Gutenberg featured image control

24 viewsblock editorblock editor
0

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 on StackExchange (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.