When editing content with FCKeditor, I often need to insert a word into an already existing sentence. When doing this, I place the caret after a word in the sentence, press spacebar, and type in the word I want to insert. Now, the problem here is that after pressing spacebar, there is now two spaces in the text. FCKeditor tries to help out by transforming one of the spaces into . However, when the new word is entered, two words are separated by instead of a normal space, and will not be breaked appropriately when the content is rendered.
Is there any way to prevent FCKeditor from transforming 2+ spaces to ?
Best Regards,
Terje Krång
Is there any way to prevent FCKeditor from transforming 2+ spaces to ?
Best Regards,
Terje Krång
Re: Preventing double space being converted into "&nbsp
Re: Preventing double space being converted into "&nbsp
Re: Preventing double space being converted into "&nbsp
This behavior is done automatically by the browser as it's the way to show the 2 spaces that the user has typed. Or do you think that it would be better for the user to start pressing the space bar and don't see any change on the screen, or that he sees some spaces in the editor and when he sees the final page all those spaces are gone because they were plain spaces instead of ?
Re: Preventing double space being converted into "&nbsp
This really isn't an option. The users of the application are usually copying and pasting from Word. Some of the time there is one space after a period, sometimes there is two.
I don't have much of a preference either way. The problem I am seeing is that getXHTML() doesn't seem to be converting the second space into . it is only converting it to & and leaving the 'nbsp;' part out. So when the data is saved, there is an & and a space in between sentences where there used to be two spaces.
Re: Preventing double space being converted into "&nbsp
With a forum application, it's difficult to tell the users to only put in one space - people are going to do whatever people are going to do.
Re: Preventing double space being converted into "&nbsp
Re: Preventing double space being converted into "&nbsp
Thanks, that's what we're doing now. I just thought maybe there was a cleaner way further down the food chain, but I guess not.
Re: Preventing double space being converted into "&nbsp
Well (F)CK me! There's really no way to turn this feature off?!
The problem I'm having is that somehow through convoluted editing - probably going back and changing things with multiple spaces - my users are getting code like this:
Re: Preventing double space being converted into "&nbsp
Hi all, as alfonsoml write there, you won't have this question anymore once you figure out it's the way how browser rendering sequential white-spaces and what is , I found this short and consise article:
http://www.xs4all.nl/~dimaroan/htl/faq1.html
Re: Preventing double space being converted into "&nbsp
You are both entirely correct, and we all acknowledge and agree that, in order for a browser to render two visible consecutive space characters, one of them must be encoded as a non-breaking space html entity.
We also agree that there are times and places where users will specifically want this behaviour; and where this preference will outweigh the niggles raised here. We have no complaint with this being the standard behaviour of (F)CKEditor.
However, what you need to understand in return, is that there are other situations (such as an HTML email building tool) where we, the techies implementing a WYSIWYG editor for completely non-technical luddite users, must prevent users entering two spaces, whether accidentally or intentionally.
There are three variations I can see for how a user could end up with an unwanted non-breaking space separating two words:
1) Type a sentence; delete a word in the middle. Once there are 2 space characters only, one is converted. 50:50 odds on then deleting the natural space.
2) Accidentally typing 2 spaces (e.g. not prssing the 'a' hard enough "in a sentence") and then deleting the second one
3) Type a sentence; add a word in the middle by first pressing space and then adding the word.
If we can't have disabling non-breaking space conversion as an option in the browser, would you at least please tell us where in the code it's implemented, so we can take it out in our own installations? (Yeah, it's been that hard to find...)
Is anyone able to point me to the relevant bit of code?
Thanks!
Re: Preventing double space being converted into "&nbsp
I am allwing users to edit posts after they have been created, and if they decide to edit mid sentence.. the is introduced even when only one space is present between the characters!
This is a major flaw in using this editor for future projects!
Please point us coders in the right direction on this one!
Re: Preventing double space being converted into "&nbsp
There's no code in CKEditor to detect such double space and insert . This is done by the browser itself and so the behavior depends on each browser, ones might be more zealous than others with regards to this issue and if you don't like it you'll have to write the code to detect the behavior and fix it.
Re: Preventing double space being converted into "&nbsp
While this can be fixed on the server side, could it be fixed by CKEditor? There are output formatting option (that might introduce more trouble than convenience) to control the HTML source, won't it be able to replace (\S \S) by (\S \S)?
Re: Preventing double space being converted into "&nbsp
Can anyone give hints on how
Can anyone give hints on how to do such a replacing within CKEditor?
I think, there could (should?) be some code in CKEditor, that
Does anything like that already exist?
Thoughts?
similar questions here
http://ckeditor.com/forums/CKEditor/Recommendations-for-how-to-deal-with-unwanted-nbsp-entities
and here
http://ckeditor.com/forums/FCKeditor-2.x/display-invisible-chars