ASPX templates
Version 7.x > ASPX templates > Kentico changing code View modes: 
User avatar
Member
Member
webteam-rospa - 12/12/2013 4:05:16 AM
   
Kentico changing code
Hi all,

We've been playing around with adding HTML to editable regions (after putting it in source mode).

When we first enter and save the code it's fine, but if we go in and save an edit (even if nothing changes, say add and delete a space) Kentico seems to make changes to our code:

Before:
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">NEBOSH Revision</h4>
<p class="list-group-item-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare mattis vulputate. Nullam eu est quis risus congue feugiat. Sed ut erat accumsan.</p>
</a>

After:
<h4 class="list-group-item-heading">
<a class="list-group-item" href="#">NEBOSH Revision</a>
</h4>
<p class="list-group-item-text">
<a class="list-group-item" href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare mattis vulputate. Nullam eu est quis risus congue feugiat. Sed ut erat accumsan.</a>
</p>

This is an issue as we are using Bootstrap, so the order of Tags is very important to make use of Bootstrap features.

Is this some kind of auto-correct feature that we can disable?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/12/2013 8:21:09 AM
   
RE:Kentico changing code
This is a "feature" of the CKEditor. Go here and test your code and see if you get the same results. Essentially what is happening is the HTML you have is not valid or compliant and the CKEditor recgonizes that and "fixes" it for you. Your <a> tag should be inside the <h4> tag, not wrapping around it.

Take a look here I give some direction as to where to find the config files for the CKEditor, you might be able to make some modifications to it so it doesn't "fix" your invalid HTML.

User avatar
Member
Member
webteam-rospa - 1/7/2014 4:31:52 AM
   
RE:Kentico changing code
Thanks for this. I feel like this is exactly what I need, but I can't seem to get it working.

Under "CMSAdminControls\CKeditor\config.js" I've added the line "CKEDITOR.config.allowedContent = true;" as suggested in:
http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter

But we're still having our code corrected. Do you have any suggestions?