Hmm. OK, well, we already know what is newline delineated because we're given newlines by the editor and they're still present in the message body. So it's not like we're totally devoid of that meaning.
That's the basics... Obviously it gets more complicated because of 5 things:
- Cutting lines that are longer than an arbitrarily decided length. I think around 80 chars would be logical, but smaller screens will show them in two lines... Whatever. Can live with that uh. Most likely these screens are on mobile -- and you know how dealing with quotes is horrible on mobile screens. The > solution is actually a great step in usability for these. (Select a line, press Return, type answer...)
- wordwrap() doesn't work on UTF, ah ah. So I have to do it differently, getting all lines that are longer than 80 chars and splitting them manually.
- words that are too long: it's relatively easy to split them to the next line... But how do we put them back together at posting time?
- tags: same here...
- how do we differentiate between line breaks that are due to long lines, and line breaks that were in the original? I thought that it could be solved by telling the editor that a 50-char line (or smaller) means a real line-break while more is a normal line. But of course, it would be too easy -- because of the aforementioned tag & long word problems, it's never easy to determine that kind of thing...
We can easily use that to define blocks of text that should be indicated with >>... but without using JS there's no way to display it.
I haven't been using JS because it can be done with PHP and JS would only complicate things. (I'm thinking this feature will only be on non-Wysiwyg anyway. I don't care -much- about Wysiwyg and Wysiwyg users probably don't even know what a non-HTML e-mail is...)
Part of me things we should just treat it as a single block of text, stick it in a paragraph tag and attach a coloured left border to it the way some email clients do. That way you essentially leave layout to the client to deal with ;)
That would mean using a contentEditable frame instead of a textarea, if you want to add coloring inside the area...