I am using TYPO3 11 and the text editor is the default CKEditor 4.
In order to get image captions within the text editor I have added the 'Enhanced Image Plugin' to the CKEditor:
myeditor.yaml
:
editor:
config:
extraPlugins:
- image2
externalPlugins:
image2:
resource: "EXT:myext/Resources/Public/CKeditor/Plugins/image2/"
This works as expected in the editor, the editor source looks like:
<figure class="image">
<img alt="" height="200" src="/fileadmin/images/image.png" width="200" />
<figcaption>Caption</figcaption>
</figure>
But the content rendered to the page renders the figcaption
as escaped HTML:
<figure class="image">
<p><img alt="" height="200" src="/fileadmin/images/logo.png" width="200"> <figcaption>Caption</figcaption> </p>
</figure>
How can I fix this?
I found that the problem comes from Fluid's format.html
.
The behaviour of it can be modifed for the RTE using typoscript:
lib.parseFunc_RTE {
#This line will enable figcaption to render as a tag:
externalBlocks := addToList(figcaption)
#This line prevents unwanted p tags being inserted in the figure tag
externalBlocks.figure.callRecursive >
}