Redactor 2 integration with code mirror I'm getting a nn string when I just click on HTML (code mirror),
is there a bug from redactor ?

I have put in hide function of Redactor these lines of code:

code = code.replace('nn&lt;/p&gt;', "&lt;/p&gt;");
code = code.replace('&lt;p&gt;n&lt;span', "&lt;p&gt;&lt;span");
code = code.replace('&lt;/span&gt;nn&lt;p', "&lt;/span&gt;&lt;p");
code = code.replace('&lt;p&gt;n&lt;/p&gt;', "");
code = code.replace('&lt;p&gt;&lt;br /&gt;&lt;/p&gt;', "");`


Is there another solution?

Thanks in advance.
Adding Code Mirror to a Redactor field is a bad idea.

The entire point of a WYSIWYG field is to allow a content editor to easily format text to be displayed on the front-end. Conversely, the entire point of Code Mirror is to colorize a snippet of code. It's hard to imagine a use-case where you'd want to colorize the value of your WYSIWYG.

Instead, I'd recommend using a plugin like Ace Freely to store code snippets. This will allow you to easily view your code snippet in the control panel, without giving it unnecessary paragraph tags and awkward spacing.

You can then apply Code Mirror on the front-end to render a colorized version of that code snippet.