Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEditor and escaping elements

I've using CKEditor for updating CMS content on my website. I also using FontAwesome, which includes set of fancy icons, that can be displayed like this

<i class="icon-envelope"></i>

The problem is that CKEditor escapes this i tag on client side, and I can't see it in source mode.

How I can allow this tag? I have tried CONFIG.removeFormatTags = '', but it dies not help.

like image 959
dzona Avatar asked Feb 12 '13 10:02

dzona


1 Answers

It is removed because it is empty. Put some non-breaking space &nbsp; or zero-width space &#8203; within it to preserve your tag.

You can also remove i from CKEDITOR.dtd.$removeEmpty object. This may, however, break other empty <i> tags without class="icon-envelope". To fix this you would need to play with a data processor to filter empty <i>'s without class="icon-envelope". Pretty easy I guess.

like image 125
oleq Avatar answered Oct 25 '22 16:10

oleq