我添加了ckeditor到我的网页管理面板
<textarea name="stateinformation" id="editor1" rows="10" cols="80">
This is my textarea to be replaced with CKEditor.
</textarea>
<script>
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
//CKEDITOR.replace( 'editor1' );
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
});
}
}
});
</script>我试着做了一些段落和项目列表。但是要添加到数据库中的数据如下所示
<p>text...</p><p> </p><p> </p><p>text...</p><ul><li>text...</li><li>text...</li><li>text...</li></ul>我尝试使用str_replace和stripslashes,但它也删除了段落和项目符号列表效果。谁能告诉我如何在不消除其影响的情况下删除这些特殊字符
发布于 2015-07-16 13:53:25
将您想要允许的标记放在Ckeditor配置文件中:例如
config.allowedContent =
'h1 h2 h3 p blockquote strong em;' +
'a[!href];' +
'img(left,right)[!src,alt,width,height];';有关更多帮助和示例,请参阅Advanced Content Filter(ACF)
https://stackoverflow.com/questions/31446064
复制相似问题