CodeIgniter Forums
[Solved] Any Codemirror expert on here I have a Question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: [Solved] Any Codemirror expert on here I have a Question (/showthread.php?tid=64067)



[Solved] Any Codemirror expert on here I have a Question - wolfgang1983 - 01-10-2016

I am working with codeigniter & Codemirror for my custom text-editor

But for some reason when I add new line in the text editor it does not show the new lines created in the question-preview div

In the question-preview div which is below the bootstrap panel  it shows all the code in one line. I need to be able to make sure it displays it new lines  correct as well in my question-preview div.

Here is a Codepen Demo

Thank you in advance.


RE: Any Codemirror expert on here I have a Question - InsiteFX - 01-10-2016

You may need to play around with the editor configuration line separator.


RE: Any Codemirror expert on here I have a Question - wolfgang1983 - 01-10-2016

(01-10-2016, 04:25 AM)InsiteFX Wrote: You may need to play around with the editor configuration line separator.

I have found out how to do it

On my script added


Code:
<br/> to

editor.getValue('<br>')


And added some css

Code:
#question-preview {
   white-space:pre-line;
}

#question-preview pre code {
   padding: 0;
   white-space: inherit;
}



RE: [Solved] Any Codemirror expert on here I have a Question - InsiteFX - 01-10-2016

Glad to see you got it working.