On the site I manage, I am using CKEditor quit extensively since a few years. I have been very happy with it and I thank the developers.
However, yesterday I wanted to enter a piece of code in a page and I installed the codefilter module. In the editor, I switched to Source and entered my piece of code between code tags. Hitting Preview i saw that the page was formated as I wanted. However, after I clicked Save, the code was completely screwed.
I spent some time looking through drupal.org, but did not find any reference to this problem.
Then I started looking into the files of the CKEditor module I quickly noticed that something existed for PHP code in the ckeditor.config.js. I therefore tried to add the following line in this file:

config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi);

It seems to me that it solves the problem. However, I am not at all sure that this is a fully correct and supportable solution.

If this, indeed, is a good solution, I would suggest to add this line in the distributed ckeditor.config.js file.

Comments

dczepierga’s picture

Title: Problem with the codefilter module » [D6] Not formatting text between code tags
Status: Active » Fixed

Changes commited to GIT.

Greetings

mkesicki’s picture

Status: Fixed » Closed (fixed)