Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports JSX: true? #5

Open
chasecee opened this issue Mar 28, 2022 · 3 comments
Open

Supports JSX: true? #5

chasecee opened this issue Mar 28, 2022 · 3 comments

Comments

@chasecee
Copy link

Love this tool, super helpful. I can't seem to get the InnerBlocks to work properly in my theme and I've tried just about everything. Since I don't see it, I'm wondering if Block Loader enables adding Supports JSX in the comment heading.

Right now the element gets added in the theme file when generating from ACF. But I can't actually add any innerblocks in the post editor. Am I missing something or has this feature not been added? In the screenshot you can see that an element gets added, but nothing can be dropped into the block or created within the block.

Screen Shot 2022-03-28 at 1 26 15 PM

!
@jakubmikita
Copy link
Contributor

@chasecee it is supported and we're using it this way daily, no additional configuration params are needed.

Seems like the valid tag is:
<InnerBlocks />

Can you confirm that works?

@chasecee
Copy link
Author

chasecee commented Apr 1, 2022

It's not working for me on a new install with no other plugins and in default theme. Here's my blocks/hero.php template file:
image

Also maybe helpful to know, here is the beginning of my functions.php:
image

If I don't have the require vendor/autoload.php, I get a PHP error. Is this common knowledge to include this? Wondering why it's not included in the docs.

Thanks for your help!

@joshuafredrickson
Copy link
Contributor

@chasecee is correct. JSX doesn't work out of the box.

I was able to get it working by using the block-params filter like so:

add_filter('micropackage/block-loader/block-params', function ($params) {
    if (in_array($params['slug'], ['carousel', 'accordion'])) {
        $params['supports']['jsx'] = true;
    }

    return $params;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants