Developer forum

Forum » CMS - Standard features » RE: How to control CK Editor parsing​

RE: How to control CK Editor parsing​

Conor McKeown
Reply
Hi Guys,
 
CK Editor removes classes from tags:  <form>  and <ul>  and strips out full tags : <label> , <i> , <button>. I know its just trying to be helpful but these are tags and classes that are standard issue in Bootstrap 3.​
 
 
If the solution is to configure parsing for CK Editor how would I do that? 
 
I have DW 8.3 and the latest version of CK Editor
 
Conor​

Replies

 
Mikkel Ricky
Reply

You have to use the allowedContent settings to allow these elements with classes (or attributes in general), i.e. your editor configuration file should contain something along the lines of

CKEDITOR.editorConfig = function(config) {
  …
​  config.allowedContent = 'form ul[*]; label i button';
  …
};

Check out Allowed Content Rules in the CKEditor 4 documentation for more details and examples on using allowedContent.

Best regards,
Mikkel

 
Conor McKeown
Reply

Hi Mikkel,

Thanks for getting back to me.  

config.allowedContent = 'form ul(*); label i button';

enables Custom Mode in CKEditor, which disables everything. 

config.extraAllowedContent = 'form ul(*); label i button';

works great. extraAllowedContent expands what is already allowed in Automatic Mode. Unfortunately the <i> tag is still not being allowed.

I also tried disabling the filtering completely with 

config.allowedContent=true;

but the <i> tag was still blocked. Is there something else that might be blocking the <i> tag?

Conor

What is Advanced Content Filter (ACF)?

 

 

 
Conor McKeown
Reply

I found something that allows an <i> tag. This is it:

config.protectedSource.push(/<i[^>]*><\/i>/g);

Thanks for your help Mikkel,

Conor

 

You must be logged in to post in the forum