Defect: CKEditor Snippet Tool CMS

mnacko's picture

The current version of Jadu (12.3.0 at the time of this post) has a defect with the snippet tool when using the new CKEditor. We use the snippet too heavily to insert javascript into pages, modify styling, etc. Sometimes when you insert a combination of Javascript and HTML depending on your linebreaks, it will strip most, if not all, of the code out. A support ticket was raised over a week ago but we have not heard back on the issue yet.

The proposed fix for this is to modify the regex used to match snippets. The dot operator does not match linebreaks. Open public_html/jadu/editors/ckeditor/config.js

Find the regex for the snippet:
config.protectedSource.push( /<([\S]+)[^>]*class="snippet"[^>]*>.*<\/\1>/g );

Replace it with:
config.protectedSource.push( /<([\S]+)[^>]*class="snippet"[^>]*>(.|\n|\r)*<\/\1>/g );

I think all you need is \n but I threw \r in just in case. It took me several hours to figure this one out. Hopefully this saves someone else some time.

General Concept: 
Jadu Product: