Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to encode HTML WYSIWYG editor CKEditor?

I use the WYSIWYG editor CKEditor on my site. I have a problem if I take a javascript script in the editor and I send these changes. It shows me a popup instead of show me the HTML string. I try to encode the text I typed but it encodes all the code created by the editor (bold, underline).

I also tried to use the configuration using the WYSIWYG editor:

config.htmlEncodeOutput = true;

By typing <script> alert ('test') </ script> in the editor, it displays correctly on the display. But if I want to re-edit my code, he wrote me this in the editor:

&lt;script&gt;alert(&quot;test&quot;);&lt;/script&gt;

Do you have any idea how to fix this?

like image 985
Florent Avatar asked Nov 01 '22 03:11

Florent


1 Answers

Try adding this code to ckeditor/config.js:

config.basicEntities = false;
config.entities = false;

Also make sure ACF is setup to not strip your code. More this here:

http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter

like image 60
Seb_CKSource Avatar answered Nov 14 '22 08:11

Seb_CKSource