Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use the CKEditor built-in whitelist engine to sanitize HTML in JavaScript

Is there a way to use the CKEditor (4.4.x) built-in whitelist engine to sanitize HTML in JavaScript? I mean, let's say I already loaded CKEditor in my page and I have a string variable containing HTML, is there a way to invoke the CKEditor filters on the string to get a sanitized, whitelisted version?

like image 871
AsGoodAsItGets Avatar asked Oct 13 '25 12:10

AsGoodAsItGets


1 Answers

Hmm, looks like it may be CKEDITOR.instances['myCKEInstance'].dataProcessor.toHtml(myHTMLstring).

http://docs.ckeditor.com/#!/api/CKEDITOR.htmlDataProcessor

like image 164
AsGoodAsItGets Avatar answered Oct 15 '25 03:10

AsGoodAsItGets