Empty spaces being retained in output

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Jonny
Forum Members
Forum Members
Posts: 77
Joined: Sun Sep 24, 2006 10:49 am

Empty spaces being retained in output

Post by Jonny »

Can anyone tell me why CMSMS might be retaining empty letter spaces? I'm seeing this both on a site that's been online for a couple of years and a fresh local install of 1.9.1 on MAMP.

If I type in spaces in the tinyMCE WYSIWYG editor and apply/submit, the spaces are visible in the output page. When re-entering the editor the spaces are still visible in WYSIWG mode.

If I switch off WYSIWYG, type in spaces and apply/submit, the spaces are not shown in the rendered page - but are visible in the source code. If I return to WYSIWYG the spaces are not visible, but the spaces continue to be visible in the editor with WYSIWYG switched off again.

So, basically, if it looks OK in tinyMCE's WYSIWYG, then the output is OK.

Switching "Apply source formatting to the output HTML" on or off has no effect on this, nor does tinyMCE's cleanup button.

As expected, tinyMCE is stripping out line returns when returning to the WYSIWYG view. So that's OK.

The test CMSMS install is unmodified on a new database.

Why I've not noticed this before is probably due to my tending to paste tidy marked up code into the code view and avoiding the WYSIWYG. I'm now preparing a site for an end-user to maintain, which will would benefit from the WYSIWYG not outputting hard coded, renderable empty spaces.

Edit 1:

Further searching on this showed the behaviour has been observed by Wordpress developers.

http://core.trac.wordpress.org/ticket/6562
core.trac.wordpress.org wrote:The Visual Editor (TinyMCE) preserves multiple sequential spaces by turning the second (and following) spaces into some sort of funky invisible hard-space character.
Maybe formatting via space bar is a "feature" of tinyMCE.

Edit 2:

Well, doing what I should have done first and testing the tinyMCE examples, it seems this is the default behaviour, BUT, when viewed in the tinyMCE HTML source editor or the source of the output page, the spaces entered are clearly non-breaking   entities rather than mysterious empty spaces.

So the remaining question is... why am I seeing empty space rather than &nbsp: characters?

Using the Plain Text paste function will strip out multiple spaces but I'm unaware of any method of enabling this for on-the-fly text entry in the WYSIWYG. Will post if/when I find a solution.
Last edited by Jonny on Sat Dec 04, 2010 4:07 pm, edited 1 time in total.
Post Reply

Return to “CMSMS Core”