Ability to use a React component as the template in the block editor preview for ACF Blocks
planned
Iain Poulson
Currently ACF Blocks needs a PHP template to render the preview of the block in the Block Editor. However, for headless builders they are building their frontend templates not in PHP but in React or another framework. When building an ACF Block, the render template is in PHP. This is used on the frontend of the site as well in the backend as the preview when editing in the block editor.
For some developers using frontend framework to render their blocks, having to recreate the same component in PHP so it can be rendered in the editor is a hassle. Allowing them to tell ACF to use the frontend component will make their lives easier and give the content editors the true preview of the block.
Andrew Harris
This would be awesome, our site is a headless NextJS site, and ACF blocks are great for more complicated attribute configuration, i.e. filtering down posts, repeaters, etc. But currently I can't preview our custom blocks on the editor using the same base React component as our frontend.
Managed to attempt a workaround using addFilter('editor.BlockEdit', 'blockname') but the way the attributes are returned means i need to remap everything from the database field_key values to field_name. And even then the way the attributes are returned is different when you first create a block, to then reloading the page, i.e. repeater attribue values change from arrays to repeater_field_name_0_field_name.
So i've just had to disable editor preview until this is implemented.
Iain Poulson
planned