Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Non-breaking spaces in editor


Reply

6 Posts   862 Views

Avatar
redactuk

26 July 2009 at 2:01am Community Member, 117 Posts

I'm using the latest version 2.3.2 and I'm sure this has only started happening, but when I edit content via the admin area I keep getting lots of non-breaking spaces included. It doesn't seem to happen as you type a sentence to start with, but if you later go back in and edit it that's when it seems to be happening. I first noticed when some sentences were no wrapping on site pages themselves as I would expect them to, and then when viewing HTML for a content area realised that this was due to lots of non-breakign spaces that seemed to have been added as I edited the content. Maybe i'm being thick here but is this something I can control maybe via some editor settings?

thanks

Avatar
steve_nyhof

5 December 2009 at 12:26pm (Last edited: 5 December 2009 12:27pm), Community Member, 224 Posts

I'm having the same issue, but with the javascript I add.

I have included the code in the LeftAndMain.php file to include javascript. My html stays fine, but the javascript added to the page keeps seporating - I think maybe on saving, closing the editor window.

var x = 1
var z = 2

----

var x = 1

var z = 2

---- later...

var x = 1

(space)
(space)
(space)
(space)
(space)

var z = 2

Any ideas to fix this issue?
Thank you,
Steve

Avatar
dalesaurus

5 December 2009 at 1:32pm Community Member, 283 Posts

I've had this happen and I blamed our frienemy TinyMCE coupled with the HTMLText the encodes/decodes text. I wasn't able to fix it without something hacky like onBeforeWrite() changes. Although perhaps this TinyMCE setting would help?

http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/remove_trailing_nbsp

You can change settings with:
http://doc.silverstripe.org/doku.php?id=htmleditorconfig

Avatar
steve_nyhof

5 December 2009 at 5:27pm Community Member, 224 Posts

Thank you.

I tried some of the things mentioned here http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/remove_trailing_nbsp , but nothing seemed to change.

This is mostly over my head. I really want to find a way to add a script like a paypal button script or other script without having to open the editor. Just click a button like adding an image, click on the screen where I want the form, etc. and add my code - click.

I have seen some of this talked about in the TM forums but I will need someone at some point if I really need to implement this.

Right now, either my connection is slow, of my script is causing the CMS to really crunch - just to open, or scroll.

And of course still like to see the script stop adding spaces.

Avatar
steve_nyhof

5 December 2009 at 5:30pm Community Member, 224 Posts

Another thought along these lines. Is there a way to add a <script> that includes my script? Like a php include in the page?

Avatar
steve_nyhof

6 December 2009 at 7:31am Community Member, 224 Posts

I am working on another work around. I did find that if I removed all returns in the code it is fine - just not very readable