Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent CKEditor from stripping < and > (greater-than/less-than)

Every time I enter < or > in a CKEditor window, save, and then come back to it, CKEditor replaces them with whatever was typed within the brackets and the accompanying end tag. For example: if I type <configuration details>, CKEditor will assume it is an HTML tag and put <configuration details></configuration details> in the html source, thus stripping it out altogether from the text. Argh!

Any ideas?

like image 447
c64 Avatar asked Aug 27 '10 03:08

c64


1 Answers

Yeah, this is a real pain.

The only workaround I've found so far is to use

CKEDITOR.instances.myInst.setData(myData);

This actually handles escaped vs. unescaped html correctly, so your < and > will come out correctly, as less-than and greater-than signs, instead of being interpreted as markup.

I haven't found a way to get this to work with inlined data yet. The setData() workaround is pretty clunky.

like image 87
mtyson Avatar answered Nov 14 '22 21:11

mtyson