On Safari, The API call InsertHtml() converts the preceding and following whitespace into a nonbreaking space ( ).
This Issue http://dev.fckeditor.net/ticket/1509 was raised for IE6/7. And from the discussion,
Since the in Safari and Opera is added by the browser rather than by FCKeditor, and they have a good reason for doing so. I suggest we only fix the issue for IE, and just leave it as-is in Opera and Safari.
So is it possible to update FCKEditor to stop it from introducing the non breaking character? I am working on application that uses XHTML content from FCKEditor with CSS3 to produce print quality documents. And the characters can cause problems with justification and hyphenation.
Re: insertHTML in Safari introduces a non breaking space
I used DOM methods to remove the nbsp characters.
I inserted a id into the html fragment inserted into the FCKEditor. Then using getElementById, I retrieve the inserted element node. And i get Previous and next sibling nodes of the inserted node.
The i used the following regex
prevSib.textContent = prevSib.textContent.replace(/\u00a0$/," ");
to replace the nbsp character.
Does this approach make sense?