开发者

How to remove unnecessary tags in CKEditor 3.x

i use the following code...

var oEditorText = CKEDITOR.instances["_TEXTAREANAME_"].getData();
return {
   _TE开发者_运维知识库XTAREANAME_ : oEditorText
};

Every time when editing one and same record are added a new tags.

How can i correct this,

Thank you in advance!


You can limit the tags that CKEditor inserts by changing the configuration settings.

I wrote an overview of why tags are inserted in certain cases and explained the use of two configuration settings in an answer to this post:

How to configure ckeditor to not wrap content in <p> block?

The answer covers more than just preventing a <p>. block from being inserted.

The two settings I explained are: config.enterMode and config.autoParagraph.

config.enterMode determines whether content is wrapped and by what tag.

config.autoParagraph determines whether inline elements such as "span" are automatically wrapped in a block element.

See that post for more details.


I pointed out a few more settings, but didn't describe them. I'll describe them here.

config.shiftEnterMode has the same options and usage as config.enterMode.

config.fillEmptyBlocks determines whether a non-breaking space ( &nbsp; ) character entity is inserted into empty block elements. In addition to setting it to true or false, you can set a function to return true or false.

config.forceEnterMode will cause the tag assigned in the config.enterMode setting to be used when ever there is a newline, regardless of the context. So if <div> is the tag assigned in enter mode and you're in a <p> tag, a newline will cause a <div> to be inserted inside the <p>.

config.ignoreEmptyParagraph when set to true, which is the default, it says that if there is no content other than an empty paragraph in the content area, the editor should return an empty value rather than an empty <p></p> tag.

As Dimon noted there is a config.fullPage setting. It is used to indicate whether the contents of the editor represents a full HTML document:

<html><head></head><body></body></html>

or a block of HTML code as is usually the case.

All of the configuration settings are described here:
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html


Problem solved:

fullPage : false
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜