New line(\n) placed in a <pre><code></code></pre>
block are stripped and line breaks are removed leaving a single continuous line of text. This occurs when switching from html to visual editors. Is there a setting in TinyMCE or hack to avoid this?
A visual example of my problem, I do use "code sample" plugin in TinyMCE editor, when I create code block using the text, the code looks like this
<pre class="language-markup"><code><php
echo "1st line";
echo "2nd line";</code></pre>
When I save the above text it saves as it is in the database (With the line break - same as above code).
When I try to edit the text again, new lines are getting removed by the TinyMCE editor so it does appear in a single line like,
<pre class="language-markup"><code><php echo "1st line"; echo "2nd line";</code></pre>
So how can I keep the line break for the code block? Bellow is the code how I init the TinyMCE
tinymce.init({
remove_linebreaks : false,
convert_newlines_to_br: true,
force_br_newlines : true,
});
please let me know if anything more required...