Blocks that don't contain a <div> element are being modified incorrectly. CMS block content does not always contain a <div> element.
- The block doesn't use PageBuilder, so
<div> is not mandatory
- The block content has been added via setup script in which it does not contain a
<div> element
- If this is saved via the admin and PageBuilder is enabled, then this will fix it but requires manual intervention
To reproduce:
Create a CMS block via a setup script:
$cmsBlock = $this->blockInterfaceFactory->create();
$cmsBlock->setIdentifier('my_cool_new_cms_block');
->setTitle('My Cool New CMS Block')
->setContent('<p>My really cool new CMS block</p>')
->setData('stores', [0]);
$this->blockRepository->save($cmsBlock);
The content when rendered on the frontend is display as such:
M data-block-indentifier="my_cool_new_cms_block"y really cool new CMS block