开发者

CKEditor Remove Extra Lines

开发者 https://www.devze.com 2023-03-29 17:16 出处:网络
CKEDitor has been giving me some issues Whe开发者_如何学Cn I\'m trying to add <p>This is a sample</p>

CKEDitor has been giving me some issues

Whe开发者_如何学Cn I'm trying to add

<p>This is a sample</p>
<p>&nbsp;</p>
<ul>
   <li>Example 1</li>
   <li>Example 2</li>
</ul>

it adds an extra line for no reason

<p>
   This is a sample</p>
<p>
   &nbsp;</p>
<ul>
   <li>
      Example 1</li>
   <li>
      Example 2</li>
</ul>

How can I fix this?


Look at http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting , especially the part about "breakAfterOpen".

CKEDITOR.replace( 'editor1',
    {
        on :
        {
            instanceReady : function( ev )
            {
                // Output paragraphs as <p>Text</p>.
                this.dataProcessor.writer.setRules( 'p',
                    {
                        indent : false,
                        breakBeforeOpen : true,
                        breakAfterOpen : false,
                        breakBeforeClose : false,
                        breakAfterClose : true
                    });
            }
        }
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消