-1

When i am passing HTML to a CKEditor instance, a P tag is being inserted within the HTML producing unexpected results.

For example, with the following code:

CKEDITOR.instances["myEditor"].setData("<div>1</div><div>2</div>");

the editor does not display them as block elements (it outputs as "12" inline). Calling getData() and i see the HTML is reformatted incorrectly as:

"<div>
<p>
    1</div><div>2</div></p>
" 

I've played with the enterMode configuration based on some research but haven't found a magic combination. Any suggestions? (I am using 3.6.5)

4

1 回答 1

0

我想通了 - 我们在粘贴时使用正则表达式去除一些标签,这也影响了初始值。

于 2012-11-09T16:47:30.030 回答