Add Rich Text Editor 

Replaces NB's <code>textarea</code> with a Rich Text Editor, using the CKEDITOR library. Functionality includes Math Formula Formatting and Code Syntax Highlighting. 
If we don't escape anything (i.e. what we're doing right now), I think 
LaTeX renders serendipitously as properly formatted formulas on the PDF, 
because Sanjoy's annotated PDF feature uses ConTexT to generate the 
annotated PDF.
On 10/31/2014 12:55 PM, David Karger wrote:
>
> In content/modules/dev/ui.threadview.js:
>
> > @@ -165,14 +165,23 @@
> >          var replymenu        = "<a class='replymenu' href='javascript:void(0)'><div class='nbicon replyicon' title='Reply' /></a>";
> >          var optionmenu        = " <a class='optionmenu' href='javascript:void(0)'><div title='Actions'>&middot;&middot;&middot;</div></a> ";
> >          var url_regex = /(\b(https?|ftp|file):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/ig;
> > -        var body        = o.body.replace(/\s/g, "") === "" ? "<span class='empty_comment'>Empty Comment</span>" : $.E(o.body).replace(/\n/g, "<br/>").replace(url_regex, "<a href=\"$1\">$1</a>");
> > +        var body        = o.body.replace(/\s/g, "") === "" ? "<span class='empty_comment'>Empty Comment</span>" : o.body;
> It's not just an issue with html. We also need to think about all the 
> latex annotatations. In HTML they are handled by mathjax, but what 
> happens when someone wants them in a pdf?
> …
> On 10/31/2014 12:39 PM, Sacha Zyto wrote: In 
> content/modules/dev/ui.threadview.js: > @@ -165,14 +165,23 @@ > var 
> replymenu = "<a class='replymenu' href='javascript:void(0)'><div 
> class='nbicon replyicon' title='Reply' /></a>"; > var optionmenu = " 
> <a class='optionmenu' href='javascript:void(0)'><div 
> title='Actions'>&middot;&middot;&middot;</div></a> "; > var url_regex 
> = 
> /(\b(https?|ftp|file):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/ig; 
> > - var body = o.body.replace(/\s/g, "") === "" ? "<span 
> class='empty_comment'>Empty Comment</span>" : 
> $.E(o.body).replace(/\n/g, "<br/>").replace(url_regex, "<a 
> href=\"$1\">$1</a>"); > + var body = o.body.replace(/\s/g, "") === "" 
> ? "<span class='empty_comment'>Empty Comment</span>" : o.body; If we 
> don't do anything, it will cause issues for comments that contain the 
> 3 following characters: & < Unless CKEditor escapes those characters, 
> but if it is so, then we'll have at least 3 issues to solve: * How 
> does CKEditor escape those characters ? We'll then need to escape 
> every previous comment in the database accordingly... * If we escape 
> certain characters, does it mean that we can't use a textbox to 
> annotate ? * What happens when using the comments in order to generate 
> documents that aren't HTML, for instance annotated PDFs: it works 
> great right now because nothing in the databased is being escaped, so 
> we store exactly what the author typed. — Reply to this email directly 
> or view it on GitHub 
> <https://github.com/nbproject/nbproject/pull/195/files#r19677862>.
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/nbproject/nbproject/pull/195/files#r19678741>.
>