2581: Fixed &nbsp; issue with new editor.

Trim the text so that we don't include the leading/trailing spaces and
turn them into &nbsp;s