我正在从后端设置CKEditor的输入。当我给出一组段落值时,它会自动插入<p> </p>
。如何避免插入标记。
<p>A wolf wants to eat the girl but is afraid to do so in public. He approaches the girl, and she naïvely tells him where she is going. <p>He suggests the girl pick some flowers, which she does. In the meantime, he goes to the grandmother's house and gains entry by pretending to be the girl.</p> He swallows the grandmother whole, and waits for the girl, disguised as the grandmother.</p>
将其加载到编辑器后,它将变为:
<p>
A wolf wants to eat the girl but is afraid to do so in public. He approaches the girl, and she naïvely tells him where she is going.</p>
<p>
He suggests the girl pick some flowers, which she does. In the meantime, he goes to the grandmother's house and gains entry by pretending to be the girl.</p>
<p>
He swallows the grandmother whole, and waits for the girl, disguised as the grandmother.</p>
<p>
</p>
我想避免额外的<p> </p>
。
我使用了以下代码,但没有用。
CKEDITOR.on( 'instanceReady', function( ev )
{
ev.editor.dataProcessor.writer.setRules( 'p',
{
indent : false,
breakBeforeOpen : false,
breakAfterOpen : false,
breakBeforeClose : false,
breakAfterClose : false
});
});
任何人都可以帮助我..
答案 0 :(得分:2)
您的HTML无效! ;)
HTML不允许嵌套段落。尝试这个,看看一切都很好(没有鬼
):
<p>A wolf wants to eat the girl but is afraid to do so in public. He approaches the girl, and she naïvely tells him where she is going.</p>
<p>He suggests the girl pick some flowers, which she does. In the meantime, he goes to the grandmother's house and gains entry by pretending to be the girl.</p>
<p>He swallows the grandmother whole, and waits for the girl, disguised as the grandmother.</p>