alfonsoml wrote:Can you explain how linebreaks and spaces affect the rendering of HTML?
Spaces and line breaks do affect rendering, depending on where they are. These two will render different. Try for yourself:
No Spaces between
<img src="box.gif"/><img src="box.gif"/>
Spaces between
<img src="box.gif"/> <img src="box.gif"/>
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.
But I don't see any spaces when I insert two images in CKEditor. Do you?
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.
alfonsoml wrote:But I don't see any spaces when I insert two images in CKEditor. Do you?
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.
Until the CKEditor gets smarter about tag formatting, you've got two choices: formatted (with your choice of indenting and spacing), and unformatted. Unformatted will preserve the spaces as you wish, but it leads to unintelligible code. When I hand-code HTML, I always format - so I actually appreciate the formatting performed by (F)CKEditor and am just fine with it being the default. So by assuming that your way is the universally correct way, "arrogant much" might apply to more than one side of this conversation...
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.
alfonsoml wrote:But I don't see any spaces when I insert two images in CKEditor. Do you?
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.
Wow. Arrogant much?
Look, you can argue that "it doesn't matter" all you want, but the fact remains that the formatting is wrong, and the editor should not artificially be adding spacing and line breaks between the start of a block element and the actual contents.
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.
I just started using CK and I like it a lot, but this issue was a big problem for me. 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.
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.
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?
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?
viewtopic.php?f=6&t=14493&p=38352&hilit=ckeditor#p38352
you must do that properly between block tagswithin
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?
http://dev.fckeditor.net/ticket/3260
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:
<textarea name="mytext" id="mytext" rows="7" cols="60"></textarea> <script type=\"text/javascript\"> CKEDITOR.replace( 'mytext', { on : { instanceReady : function( ev ) { this.dataProcessor.writer.setRules( 'pre', { indent : false, breakBeforeOpen : false, breakAfterOpen : false, breakBeforeClose : false, breakAfterClose : true }); } }, customConfig : '/ck_custom/ckeditor_config.js', }); </script>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?
http://stackoverflow.com/a/7045742/717833
CKEDITOR.on('instanceReady', function( ev ) { var blockTags = ['div','h1','h2','h3','h4','h5','h6','p','pre','li','blockquote','ul','ol', 'table','thead','tbody','tfoot','td','th',]; for (var i = 0; i < blockTags.length; i++) { ev.editor.dataProcessor.writer.setRules( blockTags[i], { indent : false, breakBeforeOpen : true, breakAfterOpen : false, breakBeforeClose : false, breakAfterClose : true }); } });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 };
CKEDITOR.on( 'instanceReady', function( ev ) { var writer = ev.editor.dataProcessor.writer; var dtd = CKEDITOR.dtd; for ( var e in CKEDITOR.tools.extend( {}, dtd.$block, dtd.$inline ) ) { ev.editor.dataProcessor.writer.setRules( e, { breakBeforeOpen : true, breakAfterOpen : true, breakAfterClose : false, breakBeforeClose : true }); } });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!