Has anyone else noticed that the latest version of the CKEditor mangles the source?
For example:
That source was perfect when I loaded the editor, it seems to have added line breaks and a great deal of space after each of the block level elements (P, DIV, etc.) Obviously this could affect how the page renders, so we don't want that.
Anyone else seeing this?
Wed, 07/22/2009 - 00:07
#1
Re: CKEditor Mangles Source?
Re: CKEditor Mangles Source?
Re: CKEditor Mangles Source?
Spaces and line breaks do affect rendering, depending on where they are. These two will render different. Try for yourself:
No Spaces between
Spaces between
The point is, CKEditor should not be reformatting the HTML I enter. If it's going to, it should do it wisely. Indenting before an <li> tag is fine. Indenting between the <li> and the actual content is not.
This is a bug.
Re: CKEditor Mangles Source?
The topic about "I want a wysiwyg editor but that doesn't touch my source code" is old. So old that it's boring. It has been explained a million times why it's this way.
In CKEditor you can configure the formatting of the output. I don't like the default values, but if you want to change those defaults (I mean not your installation but the values that are used for everybody), you'll have to provide real evidence that it's bad, not just that you don't like it.
Re: CKEditor Mangles Source?
Re: CKEditor Mangles Source?
The difference between my hand-formatting and the output from CKEditor is that I know when I don't want a space between images and other bits. This kind of intelligence sounds like an excellent development project for someone.
Re: CKEditor Mangles Source?
Also, an FYI: the HTML spec specifically states that line breaks immediately inside of tags are to be ignored, and that white space immediately inside of tags should not be relied upon - and in fact is also ignored in current browsers. http://www.w3.org/TR/html401/appendix/notes.html#notes-line-breaks
So the formatting you portray should cause no rendering issues and is syntactically correct.
Re: CKEditor Mangles Source?
As I said, I don't like the current output of CKEditor, but thanks to this post, now I just don't care.
I won't try to help to change it.
Re: CKEditor Mangles Source?
I posted about it ruining the html too. It is unusable as-is:
viewtopic.php?f=6&t=14493&p=38352&hilit=ckeditor#p38352
Surely it won't be released like this? Even if you want to format code, you must do that properly between block tags, not add breaks and spaces within block tags.
>>you can configure the formatting of the output
How do we do that to fix this problem? Or shut it off?
Otherwise very impressed with 3.0.
Thanks.
Re: CKEditor Mangles Source?
How can this be fixed so it formats correctly ONLY between block tags, or is overridden entirely?
Otherwise we have to write a parser to fix everything before it goes in the database. What a waste of time.
Re: CKEditor Mangles Source?
Re: CKEditor Mangles Source?
As there is almost zero help on this forum, I'd best post the solution here for others:
http://dev.fckeditor.net/ticket/3260
I haven't tried it (or even fully deciphered it) and obviously it doesn't fix the fact that indentation is being done wrong and must take place between block tags, not within them, but could help...
Re: CKEditor Mangles Source?
I am parsing the html to a pdf script - the additional white space is causing numerous issues. Is that "evidence" enough that this should be fixed.
Other than this problem (and this arrogant reply - which devalues greatly CKSource in my view) - this is a helpful site and the code is solid.
Re: CKEditor Mangles Source?
Any updates on this issue?
Re: CKEditor Mangles Source?
I have output from CK going to an asp server where I can debug it. It seems the editor adds \n\t to certain things when content is submitted.
Well I cracked open the ckeditor.js and searched for "\n\t". Lo and behold, there was only 1 instance of this in the whole file. I ripped it out and now im having a much better day. Hope this helps.
Re: CKEditor Mangles Source?
Re: CKEditor Mangles Source?
in
What can i do that ckeditor change not my code-position?
Re: CKEditor Mangles Source?
For Example, if you want to make sure <pre> tags are not formatted at all:
It's not a perfect solution, but if there are certain instances where source formatting is crutial, then this is a decent work-around.
J.
Re: CKEditor Mangles Source?
And (though this is, indeed, an ancient thread), this can even be easily configured for a group of elements; whichever elements you wish:
http://stackoverflow.com/a/7045742/717833
But here's what it says at that link, so you don't have to take the time to actually click it and read it...
==================
So, in my ckeditor_config.js file, after the CKEDITOR.editorConfig function, I put in this:
current version?
There is no ckeditor_config.js file in the current version and when I add this snippet to the config.js file (after the CKEDITOR.editorConfig as instructed), it doesn't appear to do anything.
Is there a new way to implement this work around?
That's where you're supposed
That's where you're supposed to add it, the config.js file. I added this right above };
And it formatted the source.
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!