日期:2014-05-17  浏览次数:20408 次

ckeditor中去掉p标签
要去掉开始和结尾的p标签,让内容直接在body中,而不是去掉回车的那个p,回车的那个p我已经去掉了,高手帮忙

------解决方案--------------------
不要P标签吗?
那好办value.Replace("<p>","").Replace("</p>",""); 这就都没了。呵呵
------解决方案--------------------
好像那个JS文件里面可以配置的,你好好找找,我原来弄过,就是不记得了
------解决方案--------------------

public string checkStr(string html)
{
System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"</p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@"<p>", 
html = regex1.Replace(html, ""); 
html = regex2.Replace(html, "");
return html;
}
------解决方案--------------------
参考
http://blog.163.com/sun__haiming/blog/static/12830906820099725122903/?fromdm&fromSearch&isFromSearchEngine=yes
------解决方案--------------------
我和LZ遇到同样的问题,但都是程序去标签。
------解决方案--------------------
在ckeditor里的ckeditor.js中修改enterMode:2即可
------解决方案--------------------
看来你这个特殊要求,挺难搞的。
有终极的解决办法。I/O输出html文件,再查找替换
value.Trim().Replace("<body><p>","<body>").Replace("</p></body>","</body>")
------解决方案--------------------
探讨

看来你这个特殊要求,挺难搞的。
有终极的解决办法。I/O输出html文件,再查找替换
value.Trim().Replace("<body><p>","<body>").Replace("</p></body>","</body>")