htmlarea and non-breaking space

htmlarea and non-breaking space

by Greg Johnson -
Number of replies: 1
Htmlarea collapses non-breaking space (xhtml coding   from the old html  ) along with all other whitespace.

It's cool that other whitespace is collapsed, but I want editing to preserve non-breaking space (as a unicode entity or &#160; or whatever). First, is this a reasonable desire in view of xhtml purity and so on? Or should I aim to use css positioning instead? My current need is to just flow some extra horizontal space to improve readability in some simple math expressions. In other contexts, the Moodle editor has irritatingly removed nonbreaking space. This can cause a line to break inappropriately. <pre> </pre> is not always an answer. Experiments with en space (u2002) etc. also brought no joy in Mudville.

If this is a reasonable desire, then how should I modify htmlarea or other components? Whitespace collapsing occurs several places. Regular expression \s is supposedly equivalent to [\f\n\r\t\v\u00A0\u2028\u2029], where u00A0 is unicode non-breaking space. Some experimental changes of \s to [\f\n\r\t\v\u2028\u2029] in htmlarea.php and get-html.js didn't do the job, though I may have missed something. I'm trying this in 1.8 and 1.9.

Average of ratings: -