extra spaces inserted with CKeditor's enterMode - causes problems in XML docs
I am using CKEditor in my website's CMS, which spits out an XML file of CDATA enclosed content to be read by flash. The problem is that CKEditor, when its enterMode is set to <p开发者_开发百科>
tags, creates a line break and a tab in the source which, when read by flash, enters space, even though I have ignoreWhiteSpace set to true. Any way to prevent ckeditor from using this behavior?
EDIT:
I still want to keep any <p> tags entered from within the editor - I just don't want all the extra space / tabs that get added in the actual source. If I use the above method, my actual code will be modified. What I'm getting if I view the source is this:
<p>
Donec at erat nec tortor sodales tempus.</p>
(an enter, and either a tab or a bunch of space after first <p> tag, instead of:
<p>Donec at erat nec tortor sodales tempus.</p>
(no spaces or breaks after <p> tag in source and I believe this is affecting the presentation of the XML. Does this help clarify at all?
You should test the "output for Flash" sample, here's a little snippet that changes just the part that you are asking, but the rest of the adjustments should be useful for you:
// Make output formatting match Flash expectations
var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) )
{
dataProcessor.writer.setRules( e,
{
indent : false,
breakBeforeOpen : false,
breakAfterOpen : false,
breakBeforeClose : false,
breakAfterClose : false
});
}
dataProcessor.writer.setRules( 'br',
{
indent : false,
breakBeforeOpen : false,
breakAfterOpen : false,
breakBeforeClose : false,
breakAfterClose : false
});
I actually solved this on the Flash end, by using
TextField.condenseWhite = true;
and
XML.ignoreWhite = true;
Which doesn't change how CKEditor spits stuff out, but it does solve the problem of how flash displays it.
精彩评论