Editor changes code

Aug 18, 2016 at 7:34 AM
This code
<h2>
<div class="feature-box feature-box-style-2">
<div class="feature-box-icon">
<em class="fa fa-server"></em></div>
</div>
More text
</h2>
Changes to
<h2>&nbsp;</h2>

<div class="feature-box feature-box-style-2">
<div class="feature-box-icon"><em class="fa fa-server"></em></div>
</div>

<p>more text</p>
What can I do to stop this from happening?
Coordinator
Aug 24, 2016 at 12:55 PM
The problem is that ckeditor always produces valid html content a div inside a header tag is not allowed. However you can turn off the cleanup via the protectSource setting in the Editor Config tab
( /<h2[\s\S]*?>[\s\S]*?<\/h2>/gi )
at this and your html code wont be changed.
Aug 24, 2016 at 6:15 PM
Thanks but that causes it to disappear in the WYSIWYG editor, not the source. Not a huge problem but annoying.