Attempting to "Convert to Blocks" silently fails on installations if the chosen block for a section of HTML is not allowed by the theme/plugin.
I ran into this because of old posts that have paragraphs containing a single URL (I narrowed it down to this by deleting chunks of the content until I found this was the offending HTML). These can't be converted because the converter tries to turn them into a URL Embed block but can't because that block is filtered out out using allowed_block_types_all. I'd expect this to just go to the next best block (core/paragraph) if that block isn't available.
From a brief look I think this is happening in htmlToBlocks where getRawTransforms is possibly including transforms for disallowed blocks? I'm not very familiar with this area of WordPress so that might be incorrect.
Step-by-step reproduction instructions
Disable the URL Embed block using allowed_block_types_all.
Create a new post.
Enter the Code Editor view.
Paste <p>https://www.example.com/</p>.
Return to Visual Editor view.
Attempt to "Convert to Blocks" on the Classic Block this creates.
Nothing happens.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
[x] Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
[x] Yes
Please confirm which theme type you used for testing.
Description
Attempting to "Convert to Blocks" silently fails on installations if the chosen block for a section of HTML is not allowed by the theme/plugin.
I ran into this because of old posts that have paragraphs containing a single URL (I narrowed it down to this by deleting chunks of the content until I found this was the offending HTML). These can't be converted because the converter tries to turn them into a URL Embed block but can't because that block is filtered out out using
allowed_block_types_all
. I'd expect this to just go to the next best block (core/paragraph) if that block isn't available.From a brief look I think this is happening in htmlToBlocks where
getRawTransforms
is possibly including transforms for disallowed blocks? I'm not very familiar with this area of WordPress so that might be incorrect.Step-by-step reproduction instructions
allowed_block_types_all
.<p>https://www.example.com/</p>
.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.