-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Custom block rendered as a classic editor block automatically #6443
Comments
This is duplicate of #5661. The plugin is loaded too late and that's why editor uses the fallback block. Can you try to use the solution described in: #5661 (comment)? |
It might be an actual issue with the wrong order of assets loaded by Gutenberg. Can you share how do you register your script in PHP? |
PHP:
JS:
I tried to load the block script at the header like you proposed and now I get two block validation errors:
I must be doing something wrong but I don't know what it is. |
This sounds much better. It means it solved the root issue. I'm working on a patch which will make it work regardless if you put |
Regarding your error, can you try to get some more help on WordPress.org slack #core-editor channel? |
Ok, I'll try that. |
Closing this because I've already found the crux of my second problem: a typo in my code. |
It should work now regardless of the location of the script (footer vs header) after #6448 got merged. |
Issue Overview
I'm taking my first steps in developing a custom block plugin based on the core gallery block and recently I stumbled into a problem. Everything seems to work as expected: at first glance the block is rendered correctly both on the editor and the frontend. But, if I save the post, then preview it and at the end I come back to edit it again, the custom block is automatically rendered in the editor as a classic editor block, although the HTML code beneath it shows that it's still a custom block. The console shows no errors.
My question is, in which conditions Gutenberg falls back to render a custom block as a classic editor block? Which is the Gutenberg function deciding this? I'm checking my
registerBlockType
function and I don't see anything strange (no block name collisions or anything similar).The text was updated successfully, but these errors were encountered: